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

Issue 8501034: Deal with unhandled exceptions the same way in all Dart api functions. (Closed)

Created:
9 years, 1 month ago by turnidge
Modified:
9 years, 1 month ago
Reviewers:
Anton Muhin, Ivan Posva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Deal with unhandled exceptions the same way in all Dart api functions. -- Terminology change: invalid handles are now called error handles. Unhandled exceptions used to be a kind of valid handle. Now they are a kind of error handle. For the Dart_Invoke* functions, this means that the standard error-checking blob drops from two tests to one test and is harder to mess up. Many other Dart api functions (Dart_ToString, for example) previously dealt with unhandled exceptions by turning them into terse error messages. Now these functions preserve information about the exceptions and generate better error messages. Changed Dart_HandleMessage to return success/failure. It seemed to fit. -- Details: Dart_IsValid becomes Dart_IsError (negated sense). Dart_GetError now knows how to print a stack trace semi-nicely. Dart_ExceptionOccurred -> Dart_IsUnhandledException. Renamed ApiFailure class to ApiError to fit better. ApiError now has a "data" pointer that points to either an error message string or to an unhandled exception object. Documentation changes aplenty.

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 20

Patch Set 3 : '' #

Total comments: 13

Patch Set 4 : '' #

Patch Set 5 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+579 lines, -464 lines) Patch
M runtime/bin/builtin.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M runtime/bin/builtin_in.cc View 1 2 3 4 5 chunks +13 lines, -13 lines 0 comments Download
M runtime/bin/dartutils.cc View 1 2 3 4 4 chunks +6 lines, -6 lines 0 comments Download
M runtime/bin/eventhandler.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M runtime/bin/file.cc View 1 2 3 4 3 chunks +4 lines, -4 lines 0 comments Download
M runtime/bin/gen_snapshot.cc View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/bin/main.cc View 1 2 3 4 8 chunks +14 lines, -41 lines 0 comments Download
M runtime/bin/process.cc View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M runtime/bin/process_script.cc View 1 2 3 4 6 chunks +7 lines, -7 lines 0 comments Download
M runtime/bin/socket.cc View 1 2 3 4 4 chunks +4 lines, -4 lines 0 comments Download
M runtime/include/dart_api.h View 1 2 3 4 26 chunks +143 lines, -106 lines 0 comments Download
M runtime/vm/dart_api_impl.h View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M runtime/vm/dart_api_impl.cc View 1 2 3 4 24 chunks +164 lines, -107 lines 0 comments Download
M runtime/vm/dart_api_impl_test.cc View 1 2 3 4 46 chunks +133 lines, -100 lines 0 comments Download
M runtime/vm/exceptions_test.cc View 1 2 3 4 2 chunks +6 lines, -6 lines 0 comments Download
M runtime/vm/isolate.cc View 1 2 3 4 1 chunk +5 lines, -1 line 0 comments Download
M runtime/vm/isolate_test.cc View 1 2 3 4 1 chunk +3 lines, -3 lines 0 comments Download
M runtime/vm/object.h View 1 2 3 4 4 chunks +15 lines, -12 lines 0 comments Download
M runtime/vm/object.cc View 1 2 3 4 6 chunks +32 lines, -16 lines 0 comments Download
M runtime/vm/parser.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/raw_object.h View 1 2 3 4 2 chunks +6 lines, -6 lines 0 comments Download
M runtime/vm/raw_object.cc View 1 2 3 4 1 chunk +3 lines, -3 lines 0 comments Download
M runtime/vm/raw_object_snapshot.cc View 1 2 3 4 1 chunk +3 lines, -3 lines 0 comments Download
M runtime/vm/snapshot_test.cc View 1 2 3 4 3 chunks +4 lines, -15 lines 0 comments Download
M runtime/vm/unit_test.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/unit_test.cc View 1 2 3 4 2 chunks +3 lines, -3 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
turnidge
9 years, 1 month ago (2011-11-09 01:46:20 UTC) #1
Anton Muhin
I really like where it's heading, thanks a lot, Todd. http://codereview.chromium.org/8501034/diff/7006/runtime/include/dart_api.h File runtime/include/dart_api.h (right): http://codereview.chromium.org/8501034/diff/7006/runtime/include/dart_api.h#newcode141 ...
9 years, 1 month ago (2011-11-09 12:34:03 UTC) #2
turnidge
http://codereview.chromium.org/8501034/diff/7006/runtime/include/dart_api.h File runtime/include/dart_api.h (right): http://codereview.chromium.org/8501034/diff/7006/runtime/include/dart_api.h#newcode141 runtime/include/dart_api.h:141: int line, On 2011/11/09 12:34:03, antonmuhin wrote: > nit: ...
9 years, 1 month ago (2011-11-09 19:53:41 UTC) #3
Anton Muhin
LGTM. When LG to Ivan, let's coordinate on landing it. http://codereview.chromium.org/8501034/diff/7006/runtime/vm/dart_api_impl.cc File runtime/vm/dart_api_impl.cc (right): http://codereview.chromium.org/8501034/diff/7006/runtime/vm/dart_api_impl.cc#newcode45 ...
9 years, 1 month ago (2011-11-10 08:28:38 UTC) #4
Ivan Posva
LGTM with comments. Mostly it is slightly lacking/unclear documentation. -Ivan http://codereview.chromium.org/8501034/diff/7006/runtime/include/dart_api.h File runtime/include/dart_api.h (right): http://codereview.chromium.org/8501034/diff/7006/runtime/include/dart_api.h#newcode846 ...
9 years, 1 month ago (2011-11-10 18:05:46 UTC) #5
turnidge
http://codereview.chromium.org/8501034/diff/7006/runtime/include/dart_api.h File runtime/include/dart_api.h (right): http://codereview.chromium.org/8501034/diff/7006/runtime/include/dart_api.h#newcode846 runtime/include/dart_api.h:846: * May generate an unhandled exception error. On 2011/11/10 ...
9 years, 1 month ago (2011-11-10 20:59:12 UTC) #6
Ivan Posva
9 years, 1 month ago (2011-11-10 21:44:06 UTC) #7
http://codereview.chromium.org/8501034/diff/9001/runtime/include/dart_api.h
File runtime/include/dart_api.h (right):

http://codereview.chromium.org/8501034/diff/9001/runtime/include/dart_api.h#n...
runtime/include/dart_api.h:123: DART_EXPORT Dart_Handle
Dart_GetException(Dart_Handle handle);
On 2011/11/10 20:59:13, turnidge wrote:
> On 2011/11/10 18:05:46, Ivan Posva wrote:
> > Dart_ErrorGetException maybe to be in consistent with other calls such as
> > Dart_IntegerValue. Dart_UnhandledExceptionGetException which would the exact
> > one, is just a tad unwieldy.
> 
> Changed to Dart_ErrorGetException, and Dart_ErrorGetStacktrace.
> 
> I also changed Dart_IsUnhandledException to Dart_ErrorHasException.  Seems
less
> confusing to me.  WDYT?  Another possibility is Dart_ErrorIsException.

Much clearer as it also cleans up confusing verbiage in the comment.

Powered by Google App Engine
This is Rietveld 408576698