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

Issue 1383983002: Make root-zone handleUncaughtError rethrow with the correct stack. (Closed)

Created:
5 years, 2 months ago by Lasse Reichstein Nielsen
Modified:
5 years, 2 months ago
Reviewers:
turnidge, Ivan Posva
CC:
reviews_dartlang.org, vm-dev_dartlang.org, floitsch, Ivan Posva
Base URL:
https://github.com/dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Make root-zone handleUncaughtError rethrow with the correct stack. Adds _rethrow function which reifies the stack trace of an async error on the VM. There is no corresponding JS functionality, it still just throws an AsyncError wrapper. Fixes issue #24163 BUG= http://dartbug.com/24163 R=iposva@google.com, turnidge@google.com Committed: https://github.com/dart-lang/sdk/commit/da8baacae46e5f1f00d90ada1fa85dc0a9e0286c

Patch Set 1 #

Total comments: 11
Unified diffs Side-by-side diffs Delta from patch set Stats (+21 lines, -21 lines) Patch
M runtime/lib/async_patch.dart View 1 chunk +2 lines, -0 lines 2 comments Download
M runtime/lib/errors.cc View 1 chunk +8 lines, -0 lines 0 comments Download
M runtime/vm/bootstrap_natives.h View 1 chunk +1 line, -0 lines 0 comments Download
M sdk/lib/_internal/js_runtime/lib/async_patch.dart View 1 chunk +5 lines, -0 lines 2 comments Download
M sdk/lib/async/zone.dart View 2 chunks +5 lines, -21 lines 7 comments Download

Messages

Total messages: 10 (2 generated)
Lasse Reichstein Nielsen
5 years, 2 months ago (2015-10-02 07:52:49 UTC) #2
nweiz
👍
5 years, 2 months ago (2015-10-02 20:35:23 UTC) #3
turnidge
lgtm w/ 2 comments. https://codereview.chromium.org/1383983002/diff/1/sdk/lib/async/zone.dart File sdk/lib/async/zone.dart (left): https://codereview.chromium.org/1383983002/diff/1/sdk/lib/async/zone.dart#oldcode1030 sdk/lib/async/zone.dart:1030: } What's all this about? ...
5 years, 2 months ago (2015-10-02 21:00:53 UTC) #4
Lasse Reichstein Nielsen
https://codereview.chromium.org/1383983002/diff/1/sdk/lib/async/zone.dart File sdk/lib/async/zone.dart (left): https://codereview.chromium.org/1383983002/diff/1/sdk/lib/async/zone.dart#oldcode1030 sdk/lib/async/zone.dart:1030: } My editor told me the class was unused, ...
5 years, 2 months ago (2015-10-02 22:50:59 UTC) #5
turnidge
lgtm https://codereview.chromium.org/1383983002/diff/1/sdk/lib/async/zone.dart File sdk/lib/async/zone.dart (right): https://codereview.chromium.org/1383983002/diff/1/sdk/lib/async/zone.dart#newcode894 sdk/lib/async/zone.dart:894: if (error == null) error = new NullThrownError(); ...
5 years, 2 months ago (2015-10-02 22:54:35 UTC) #6
Ivan Posva
LGTM with comments. -Ivan https://codereview.chromium.org/1383983002/diff/1/runtime/lib/async_patch.dart File runtime/lib/async_patch.dart (right): https://codereview.chromium.org/1383983002/diff/1/runtime/lib/async_patch.dart#newcode186 runtime/lib/async_patch.dart:186: patch void _rethrow(Object error, StackTrace ...
5 years, 2 months ago (2015-10-02 23:40:39 UTC) #8
Lasse Reichstein Nielsen
Committed patchset #1 (id:1) manually as da8baacae46e5f1f00d90ada1fa85dc0a9e0286c (presubmit successful).
5 years, 2 months ago (2015-10-05 06:17:30 UTC) #9
Lasse Reichstein Nielsen
5 years, 2 months ago (2015-10-05 06:18:49 UTC) #10
Message was sent while issue was closed.
https://codereview.chromium.org/1383983002/diff/1/runtime/lib/async_patch.dart
File runtime/lib/async_patch.dart (right):

https://codereview.chromium.org/1383983002/diff/1/runtime/lib/async_patch.dar...
runtime/lib/async_patch.dart:186: patch void _rethrow(Object error, StackTrace
stackTrace) native "Zone_rethrow";
Renamed to Async_rethrow.
It's top-level because it's called from another top-level function. There isn't
any class that it would obviously belong to.
I considered Error, but it's in a different library, so it would have to be
public, and then we would have to implement it in JavaScript too, which isn't
obvious to me how to do (even though having the functionality public would be
awesome!)

https://codereview.chromium.org/1383983002/diff/1/sdk/lib/_internal/js_runtim...
File sdk/lib/_internal/js_runtime/lib/async_patch.dart (right):

https://codereview.chromium.org/1383983002/diff/1/sdk/lib/_internal/js_runtim...
sdk/lib/_internal/js_runtime/lib/async_patch.dart:512: throw new
AsyncError(error, stackTrace);
I haven't found a way to throw an object *and* a stack-trace in JS.
Maybe there is a way, in which case we can add it here.

The behavior is (so far) only used for re-throwing an uncaught async error, so
the only thing that happens with the thrown error is that it's printed in the
console, or its string representations are captured by an isolate. This error
object has the same string representation as the original.

The VM version just got better, and that's great. Even if we can't make the JS
version better, it's still an improvement.

https://codereview.chromium.org/1383983002/diff/1/sdk/lib/async/zone.dart
File sdk/lib/async/zone.dart (right):

https://codereview.chromium.org/1383983002/diff/1/sdk/lib/async/zone.dart#new...
sdk/lib/async/zone.dart:900: external void _rethrow(Object error, StackTrace
stackTrace);
I think Object is the right type here - it's accepting any object, and we won't
use it dynamically, so Object is the precise type. 

I also think that the Zone's error object should have been typed as Object, but
I guess that's too late to fix.

Powered by Google App Engine
This is Rietveld 408576698