Skip to content

Commit de9e3a3

Browse files
committed
Set auto breakpoint at various errors
Any reason not to do this? I generally find when framework code wraps these errors, it just complicates finding the original bug. Better to just trap. Perhaps should just inline the call to debugger though. I put in dart.debugger with the thought of making it configurable. [email protected], [email protected] Review URL: https://codereview.chromium.org/2519873004 .
1 parent ed4c2cb commit de9e3a3

File tree

6 files changed

+45
-0
lines changed

6 files changed

+45
-0
lines changed

pkg/dev_compiler/lib/js/amd/dart_sdk.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,24 +1420,31 @@ define([], function() {
14201420
return true;
14211421
};
14221422
dart.throwCastError = function(object, actual, type) {
1423+
debugger;
14231424
dart.throw(new _js_helper.CastErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
14241425
};
14251426
dart.throwTypeError = function(object, actual, type) {
1427+
debugger;
14261428
dart.throw(new _js_helper.TypeErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
14271429
};
14281430
dart.throwStrongModeCastError = function(object, actual, type) {
1431+
debugger;
14291432
dart.throw(new _js_helper.StrongModeCastError(object, dart.typeName(actual), dart.typeName(type)));
14301433
};
14311434
dart.throwStrongModeTypeError = function(object, actual, type) {
1435+
debugger;
14321436
dart.throw(new _js_helper.StrongModeTypeError(object, dart.typeName(actual), dart.typeName(type)));
14331437
};
14341438
dart.throwUnimplementedError = function(message) {
1439+
debugger;
14351440
dart.throw(new core.UnimplementedError(message));
14361441
};
14371442
dart.throwAssertionError = function() {
1443+
debugger;
14381444
dart.throw(new core.AssertionError());
14391445
};
14401446
dart.throwNullValueError = function() {
1447+
debugger;
14411448
dart.throw(new core.NoSuchMethodError(null, new core.Symbol('<Unexpected Null Value>'), null, null, null));
14421449
};
14431450
dart.syncStar = function(gen, E, ...args) {
@@ -1968,9 +1975,11 @@ define([], function() {
19681975
return Object.getOwnPropertySymbols(obj);
19691976
};
19701977
dart.throwStrongModeError = function(message) {
1978+
debugger;
19711979
throw new _js_helper.StrongModeErrorImplementation(message);
19721980
};
19731981
dart.throwInternalError = function(message) {
1982+
debugger;
19741983
throw Error(message);
19751984
};
19761985
dart.getOwnNamesAndSymbols = function(obj) {

pkg/dev_compiler/lib/js/common/dart_sdk.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,24 +1420,31 @@
14201420
return true;
14211421
};
14221422
dart.throwCastError = function(object, actual, type) {
1423+
debugger;
14231424
dart.throw(new _js_helper.CastErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
14241425
};
14251426
dart.throwTypeError = function(object, actual, type) {
1427+
debugger;
14261428
dart.throw(new _js_helper.TypeErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
14271429
};
14281430
dart.throwStrongModeCastError = function(object, actual, type) {
1431+
debugger;
14291432
dart.throw(new _js_helper.StrongModeCastError(object, dart.typeName(actual), dart.typeName(type)));
14301433
};
14311434
dart.throwStrongModeTypeError = function(object, actual, type) {
1435+
debugger;
14321436
dart.throw(new _js_helper.StrongModeTypeError(object, dart.typeName(actual), dart.typeName(type)));
14331437
};
14341438
dart.throwUnimplementedError = function(message) {
1439+
debugger;
14351440
dart.throw(new core.UnimplementedError(message));
14361441
};
14371442
dart.throwAssertionError = function() {
1443+
debugger;
14381444
dart.throw(new core.AssertionError());
14391445
};
14401446
dart.throwNullValueError = function() {
1447+
debugger;
14411448
dart.throw(new core.NoSuchMethodError(null, new core.Symbol('<Unexpected Null Value>'), null, null, null));
14421449
};
14431450
dart.syncStar = function(gen, E, ...args) {
@@ -1968,9 +1975,11 @@
19681975
return Object.getOwnPropertySymbols(obj);
19691976
};
19701977
dart.throwStrongModeError = function(message) {
1978+
debugger;
19711979
throw new _js_helper.StrongModeErrorImplementation(message);
19721980
};
19731981
dart.throwInternalError = function(message) {
1982+
debugger;
19741983
throw Error(message);
19751984
};
19761985
dart.getOwnNamesAndSymbols = function(obj) {

pkg/dev_compiler/lib/js/es6/dart_sdk.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,24 +1418,31 @@ dart.isGroundType = function(type) {
14181418
return true;
14191419
};
14201420
dart.throwCastError = function(object, actual, type) {
1421+
debugger;
14211422
dart.throw(new _js_helper.CastErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
14221423
};
14231424
dart.throwTypeError = function(object, actual, type) {
1425+
debugger;
14241426
dart.throw(new _js_helper.TypeErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
14251427
};
14261428
dart.throwStrongModeCastError = function(object, actual, type) {
1429+
debugger;
14271430
dart.throw(new _js_helper.StrongModeCastError(object, dart.typeName(actual), dart.typeName(type)));
14281431
};
14291432
dart.throwStrongModeTypeError = function(object, actual, type) {
1433+
debugger;
14301434
dart.throw(new _js_helper.StrongModeTypeError(object, dart.typeName(actual), dart.typeName(type)));
14311435
};
14321436
dart.throwUnimplementedError = function(message) {
1437+
debugger;
14331438
dart.throw(new core.UnimplementedError(message));
14341439
};
14351440
dart.throwAssertionError = function() {
1441+
debugger;
14361442
dart.throw(new core.AssertionError());
14371443
};
14381444
dart.throwNullValueError = function() {
1445+
debugger;
14391446
dart.throw(new core.NoSuchMethodError(null, new core.Symbol('<Unexpected Null Value>'), null, null, null));
14401447
};
14411448
dart.syncStar = function(gen, E, ...args) {
@@ -1966,9 +1973,11 @@ dart.getOwnPropertySymbols = function(obj) {
19661973
return Object.getOwnPropertySymbols(obj);
19671974
};
19681975
dart.throwStrongModeError = function(message) {
1976+
debugger;
19691977
throw new _js_helper.StrongModeErrorImplementation(message);
19701978
};
19711979
dart.throwInternalError = function(message) {
1980+
debugger;
19721981
throw Error(message);
19731982
};
19741983
dart.getOwnNamesAndSymbols = function(obj) {

pkg/dev_compiler/lib/js/legacy/dart_sdk.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,24 +1421,31 @@ dart_library.library('dart_sdk', null, /* Imports */[
14211421
return true;
14221422
};
14231423
dart.throwCastError = function(object, actual, type) {
1424+
debugger;
14241425
dart.throw(new _js_helper.CastErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
14251426
};
14261427
dart.throwTypeError = function(object, actual, type) {
1428+
debugger;
14271429
dart.throw(new _js_helper.TypeErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
14281430
};
14291431
dart.throwStrongModeCastError = function(object, actual, type) {
1432+
debugger;
14301433
dart.throw(new _js_helper.StrongModeCastError(object, dart.typeName(actual), dart.typeName(type)));
14311434
};
14321435
dart.throwStrongModeTypeError = function(object, actual, type) {
1436+
debugger;
14331437
dart.throw(new _js_helper.StrongModeTypeError(object, dart.typeName(actual), dart.typeName(type)));
14341438
};
14351439
dart.throwUnimplementedError = function(message) {
1440+
debugger;
14361441
dart.throw(new core.UnimplementedError(message));
14371442
};
14381443
dart.throwAssertionError = function() {
1444+
debugger;
14391445
dart.throw(new core.AssertionError());
14401446
};
14411447
dart.throwNullValueError = function() {
1448+
debugger;
14421449
dart.throw(new core.NoSuchMethodError(null, new core.Symbol('<Unexpected Null Value>'), null, null, null));
14431450
};
14441451
dart.syncStar = function(gen, E, ...args) {
@@ -1969,9 +1976,11 @@ dart_library.library('dart_sdk', null, /* Imports */[
19691976
return Object.getOwnPropertySymbols(obj);
19701977
};
19711978
dart.throwStrongModeError = function(message) {
1979+
debugger;
19721980
throw new _js_helper.StrongModeErrorImplementation(message);
19731981
};
19741982
dart.throwInternalError = function(message) {
1983+
debugger;
19751984
throw Error(message);
19761985
};
19771986
dart.getOwnNamesAndSymbols = function(obj) {

pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,48 @@
44
part of dart._runtime;
55

66
throwCastError(object, actual, type) => JS('', '''(() => {
7+
debugger;
78
$throw_(new $CastErrorImplementation($object,
89
$typeName($actual),
910
$typeName($type)));
1011
})()''');
1112

1213
throwTypeError(object, actual, type) => JS('', '''(() => {
14+
debugger;
1315
$throw_(new $TypeErrorImplementation($object,
1416
$typeName($actual),
1517
$typeName($type)));
1618
})()''');
1719

1820
throwStrongModeCastError(object, actual, type) => JS('', '''(() => {
21+
debugger;
1922
$throw_(new $StrongModeCastError($object,
2023
$typeName($actual),
2124
$typeName($type)));
2225
})()''');
2326

2427
throwStrongModeTypeError(object, actual, type) => JS('', '''(() => {
28+
debugger;
2529
$throw_(new $StrongModeTypeError($object,
2630
$typeName($actual),
2731
$typeName($type)));
2832
})()''');
2933

3034
throwUnimplementedError(message) => JS('', '''(() => {
35+
debugger;
3136
$throw_(new $UnimplementedError($message));
3237
})()''');
3338

3439
throwAssertionError() => JS('', '''(() => {
40+
debugger;
3541
$throw_(new $AssertionError());
3642
})()''');
3743

3844
throwNullValueError() => JS('', '''(() => {
3945
// TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought
4046
// to thread through method info, but that uglifies the code and can't
4147
// actually be queried ... it only affects how the error is printed.
48+
debugger;
4249
$throw_(new $NoSuchMethodError(null,
4350
new $Symbol('<Unexpected Null Value>'), null, null, null));
4451
})()''');

pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ final hasOwnProperty = JS('', 'Object.prototype.hasOwnProperty');
2424
/// This error indicates a strong mode specific failure, other than a type
2525
/// assertion failure (TypeError) or CastError.
2626
void throwStrongModeError(String message) {
27+
JS('', 'debugger');
2728
JS('', 'throw new #(#);', StrongModeErrorImplementation, message);
2829
}
2930

3031
/// This error indicates a bug in the runtime or the compiler.
3132
void throwInternalError(String message) {
33+
JS('', 'debugger');
3234
JS('', 'throw Error(#)', message);
3335
}
3436

0 commit comments

Comments
 (0)