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

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/lib/async/async_error.dart

Issue 2698353003: unfork DDC's copy of most SDK libraries (Closed)
Patch Set: revert core_patch Created 3 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 part of dart.async;
6
7 _invokeErrorHandler(Function errorHandler,
8 Object error, StackTrace stackTrace) {
9 if (errorHandler is ZoneBinaryCallback) {
10 return errorHandler(error, stackTrace);
11 } else {
12 ZoneUnaryCallback unaryErrorHandler = errorHandler;
13 return unaryErrorHandler(error);
14 }
15 }
16
17 Function _registerErrorHandler/*<R>*/(Function errorHandler, Zone zone) {
18 if (errorHandler is ZoneBinaryCallback) {
19 // TODO(leafp): These are commented out, because the async libraries
20 // pass a (...) -> void into this function which fails whenever R
21 // is something interesting. This needs to be sorted out in the main
22 // SDK as to what the intent is here: if this is really supposed to
23 // return an R, then the function that gets passed in is wrong. If not,
24 // then this code doesn't need to track the return type at all.
25 // return zone.registerBinaryCallback/*<R, dynamic, StackTrace>*/(
26 // errorHandler as dynamic/*=ZoneBinaryCallback<R, dynamic, StackTrac e>*/);
27 return zone.registerBinaryCallback/*<dynamic, dynamic, StackTrace>*/(
28 errorHandler as dynamic/*=ZoneBinaryCallback<dynamic, dynamic, StackTrac e>*/);
29 } else {
30 // return zone.registerUnaryCallback/*<R, dynamic>*/(
31 // errorHandler as dynamic/*=ZoneUnaryCallback<R, dynamic>*/);
32 return zone.registerUnaryCallback/*<dynamic, dynamic>*/(
33 errorHandler as dynamic/*=ZoneUnaryCallback<dynamic, dynamic>*/);
34 }
35 }
36
37 class _UncaughtAsyncError extends AsyncError {
38 _UncaughtAsyncError(error, StackTrace stackTrace)
39 : super(error, _getBestStackTrace(error, stackTrace));
40
41 static StackTrace _getBestStackTrace(error, StackTrace stackTrace) {
42 if (stackTrace != null) return stackTrace;
43 if (error is Error) {
44 return error.stackTrace;
45 }
46 return null;
47 }
48
49 String toString() {
50 String result = "Uncaught Error: ${error}";
51
52 if (stackTrace != null) {
53 result += "\nStack Trace:\n$stackTrace";
54 }
55 return result;
56 }
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698