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

Side by Side Diff: pkg/barback/lib/src/serialize.dart

Issue 68493003: Ensure that errors have stack traces attached. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/barback/lib/src/asset_cascade.dart ('k') | pkg/http/lib/src/utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library barback.serialize; 5 library barback.serialize;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:isolate'; 8 import 'dart:isolate';
9 9
10 import 'package:stack_trace/stack_trace.dart'; 10 import 'package:stack_trace/stack_trace.dart';
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 /// The body of a [StreamTransformer] that deserializes the values in a stream 55 /// The body of a [StreamTransformer] that deserializes the values in a stream
56 /// sent by [serializeStream]. 56 /// sent by [serializeStream].
57 StreamSubscription _deserializeTransformer(Stream input, bool cancelOnError) { 57 StreamSubscription _deserializeTransformer(Stream input, bool cancelOnError) {
58 var subscription; 58 var subscription;
59 var transformed = input.transform(new StreamTransformer.fromHandlers( 59 var transformed = input.transform(new StreamTransformer.fromHandlers(
60 handleData: (data, sink) { 60 handleData: (data, sink) {
61 if (data['type'] == 'data') { 61 if (data['type'] == 'data') {
62 sink.add(data['data']); 62 sink.add(data['data']);
63 } else if (data['type'] == 'error') { 63 } else if (data['type'] == 'error') {
64 sink.addError(new CrossIsolateException.deserialize(data['error'])); 64 var exception = new CrossIsolateException.deserialize(data['error']);
65 sink.addError(exception, exception.stackTrace);
65 } else { 66 } else {
66 assert(data['type'] == 'done'); 67 assert(data['type'] == 'done');
67 sink.close(); 68 sink.close();
68 subscription.cancel(); 69 subscription.cancel();
69 } 70 }
70 })); 71 }));
71 subscription = transformed.listen(null, cancelOnError: cancelOnError); 72 subscription = transformed.listen(null, cancelOnError: cancelOnError);
72 return subscription; 73 return subscription;
73 } 74 }
74 75
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // short of a giant pile of type tests for each known exception type. 130 // short of a giant pile of type tests for each known exception type.
130 // 131 //
131 // So just try it. If it throws, default to toString(). 132 // So just try it. If it throws, default to toString().
132 String _getErrorMessage(error) { 133 String _getErrorMessage(error) {
133 try { 134 try {
134 return error.message; 135 return error.message;
135 } on NoSuchMethodError catch (_) { 136 } on NoSuchMethodError catch (_) {
136 return error.toString(); 137 return error.toString();
137 } 138 }
138 } 139 }
OLDNEW
« no previous file with comments | « pkg/barback/lib/src/asset_cascade.dart ('k') | pkg/http/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698