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

Issue 11369243: Make Exception a class, not an interface, and remove the const constructor. (Closed)

Created:
8 years, 1 month ago by Lasse Reichstein Nielsen
Modified:
8 years, 1 month ago
Reviewers:
Bob Nystrom, floitsch
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Make Exception a class, not an interface, and remove the const constructor. We should consider removing the constructor entirely, there is never a good excuse for throwing a non-descript Exception. If you do, it should likely be an Error instead. Committed: https://code.google.com/p/dart/source/detail?r=15077

Patch Set 1 #

Total comments: 4

Patch Set 2 : Updated. Moved safeToString to Error. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+82 lines, -64 lines) Patch
M runtime/lib/errors_patch.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/_internal/compiler/implementation/lib/core_patch.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/core/errors.dart View 1 4 chunks +29 lines, -23 lines 0 comments Download
M sdk/lib/core/exceptions.dart View 1 1 chunk +17 lines, -5 lines 0 comments Download
M sdk/lib/html/dart2js/html_dart2js.dart View 1 16 chunks +16 lines, -16 lines 0 comments Download
M sdk/lib/html/scripts/systemhtml.py View 1 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/io/file_impl.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M tests/corelib/safe_to_string_test.dart View 1 1 chunk +12 lines, -12 lines 0 comments Download
M tests/html/indexeddb_1_test.dart View 2 chunks +2 lines, -2 lines 0 comments Download
M tests/html/indexeddb_2_test.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M tests/language/type_error_test.dart View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 7 (0 generated)
Lasse Reichstein Nielsen
For committing when we can break things again.
8 years, 1 month ago (2012-11-14 15:24:18 UTC) #1
floitsch
LGTM. https://codereview.chromium.org/11369243/diff/1/sdk/lib/core/exceptions.dart File sdk/lib/core/exceptions.dart (right): https://codereview.chromium.org/11369243/diff/1/sdk/lib/core/exceptions.dart#newcode20 sdk/lib/core/exceptions.dart:20: String toString() => (message == null) ? "Exception" ...
8 years, 1 month ago (2012-11-14 15:43:22 UTC) #2
Bob Nystrom
https://codereview.chromium.org/11369243/diff/1/sdk/lib/core/exceptions.dart File sdk/lib/core/exceptions.dart (right): https://codereview.chromium.org/11369243/diff/1/sdk/lib/core/exceptions.dart#newcode20 sdk/lib/core/exceptions.dart:20: String toString() => (message == null) ? "Exception" : ...
8 years, 1 month ago (2012-11-14 18:02:39 UTC) #3
Lasse Reichstein Nielsen
I would actually prefer to make Exception completely abstract and not give it a default ...
8 years, 1 month ago (2012-11-16 08:21:01 UTC) #4
Lasse Reichstein Nielsen
https://codereview.chromium.org/11369243/diff/1/sdk/lib/core/exceptions.dart File sdk/lib/core/exceptions.dart (right): https://codereview.chromium.org/11369243/diff/1/sdk/lib/core/exceptions.dart#newcode20 sdk/lib/core/exceptions.dart:20: String toString() => (message == null) ? "Exception" : ...
8 years, 1 month ago (2012-11-16 08:22:48 UTC) #5
sra1
On 2012/11/16 08:21:01, Lasse Reichstein Nielsen wrote: > I would actually prefer to make Exception ...
8 years, 1 month ago (2012-11-16 08:31:32 UTC) #6
Lasse Reichstein Nielsen
8 years, 1 month ago (2012-11-19 13:18:53 UTC) #7
https://codereview.chromium.org/11369243/diff/1/sdk/lib/core/exceptions.dart
File sdk/lib/core/exceptions.dart (right):

https://codereview.chromium.org/11369243/diff/1/sdk/lib/core/exceptions.dart#...
sdk/lib/core/exceptions.dart:20: String toString() => (message == null) ?
"Exception" : "Exception: $message";
Seems some tests expect the exact output that we currently have. We should fix
those too eventually, and perhaps use safeToString, but not now.
I moved safeToString to Error, since it seems generally useful. It used to be in
NoSuchMethodError.

Powered by Google App Engine
This is Rietveld 408576698