OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /// Generic utility functions. Stuff that should possibly be in core. | 5 /// Generic utility functions. Stuff that should possibly be in core. |
6 library pub.utils; | 6 library pub.utils; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import "dart:collection"; | 9 import "dart:collection"; |
10 import "dart:convert"; | 10 import "dart:convert"; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 110 } |
111 completer.completeError(e, stackTrace); | 111 completer.completeError(e, stackTrace); |
112 }); | 112 }); |
113 }; | 113 }; |
114 | 114 |
115 if (captureStackChains) { | 115 if (captureStackChains) { |
116 Chain.capture(wrappedCallback, onError: completer.completeError); | 116 Chain.capture(wrappedCallback, onError: completer.completeError); |
117 } else { | 117 } else { |
118 runZoned(wrappedCallback, onError: (e, stackTrace) { | 118 runZoned(wrappedCallback, onError: (e, stackTrace) { |
119 if (stackTrace == null) { | 119 if (stackTrace == null) { |
| 120 stackTrace = new Chain.current(); |
| 121 } else { |
120 stackTrace = new Chain([new Trace.from(stackTrace)]); | 122 stackTrace = new Chain([new Trace.from(stackTrace)]); |
121 } else { | |
122 stackTrace = new Chain([]); | |
123 } | 123 } |
124 completer.completeError(e, stackTrace); | 124 completer.completeError(e, stackTrace); |
125 }); | 125 }); |
126 } | 126 } |
127 | 127 |
128 return completer.future; | 128 return completer.future; |
129 } | 129 } |
130 | 130 |
131 /// Returns a [StreamTransformer] that will call [onDone] when the stream | 131 /// Returns a [StreamTransformer] that will call [onDone] when the stream |
132 /// completes. | 132 /// completes. |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 error is AnalyzerErrorGroup || | 861 error is AnalyzerErrorGroup || |
862 error is IsolateSpawnException || | 862 error is IsolateSpawnException || |
863 error is FileSystemException || | 863 error is FileSystemException || |
864 error is HttpException || | 864 error is HttpException || |
865 error is http.ClientException || | 865 error is http.ClientException || |
866 error is OSError || | 866 error is OSError || |
867 error is ProcessException || | 867 error is ProcessException || |
868 error is SocketException || | 868 error is SocketException || |
869 error is WebSocketException; | 869 error is WebSocketException; |
870 } | 870 } |
OLD | NEW |