Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(861)

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/transformer_isolate.dart

Issue 352923002: Gracefully handle transformers rejecting their configuration. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/transformer/a_transformer_rejects_its_config_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/barback/transformer_isolate.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/transformer_isolate.dart b/sdk/lib/_internal/pub/lib/src/barback/transformer_isolate.dart
index 2cb9e6d7cf70574564c57a5d076b7731acd64391..fde485507a90067889efbaf185297727e91ed2cf 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/transformer_isolate.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/transformer_isolate.dart
@@ -9,9 +9,12 @@ import 'dart:convert';
import 'dart:isolate';
import 'package:barback/barback.dart';
+import 'package:source_maps/source_maps.dart';
+import 'package:stack_trace/stack_trace.dart';
import '../../../asset/dart/serialize.dart';
import '../barback.dart';
+import '../exceptions.dart';
import '../dart.dart' as dart;
import '../log.dart' as log;
import '../utils.dart';
@@ -112,6 +115,18 @@ class TransformerIsolate {
.toSet();
log.fine("Transformers from $config: $transformers");
return transformers;
+ }).catchError((error, stackTrace) {
+ throw new TransformerLoadError(error, config.span);
});
}
}
+
+/// An error thrown when a transformer fails to load.
+class TransformerLoadError extends SpanException implements WrappedException {
+ final CrossIsolateException innerError;
+ Chain get innerChain => innerError.stackTrace;
+
+ TransformerLoadError(CrossIsolateException error, Span span)
+ : innerError = error,
+ super("Error loading transformer: ${error.message}", span);
+}
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/transformer/a_transformer_rejects_its_config_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698