Skip to content

Commit cf43e2a

Browse files
mkustermannCommit Queue
authored andcommitted
[dart2wasm] Throw UnsupportedError instead of string in IndexError.* getters
This is a follow-up to [0]. [0] https://dart-review.googlesource.com/c/sdk/+/435783B Change-Id: I18e85980a782ae851edd265da0d451f131e594c0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436282 Reviewed-by: Lasse Nielsen <[email protected]> Commit-Queue: Martin Kustermann <[email protected]> Reviewed-by: Ömer Ağacan <[email protected]>
1 parent 150e8cb commit cf43e2a

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

sdk/lib/_internal/wasm/lib/error_utils.dart

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ const _reachabilityError = _LateErrorWithoutDetails(
258258

259259
const _noSuchMethodErrorWithoutDetails = _NoSuchMethodErrorWithoutDetails();
260260

261+
const _unsupportedErrorWithoutDetails = _UnsupportedErrorWithoutDetails();
262+
261263
const typeErrorWithoutDetails = _TypeErrorWithoutDetails();
262264

263265
class _ErrorWithoutDetails implements Error {
@@ -278,7 +280,7 @@ class _ArgumentErrorWithoutDetails extends _ErrorWithoutDetails
278280
String? get name => null;
279281

280282
@override
281-
String get message => toString();
283+
String get message => _message;
282284

283285
@override
284286
dynamic get invalidValue => null;
@@ -290,16 +292,16 @@ class _IndexErrorWithoutDetails extends _ArgumentErrorWithoutDetails
290292
: super('IndexError (details omitted due to --minify)');
291293

292294
@override
293-
int get start => throw 'no details';
295+
int get start => throw _unsupportedErrorWithoutDetails;
294296

295297
@override
296-
int get end => throw 'no details';
298+
int get end => throw _unsupportedErrorWithoutDetails;
297299

298300
@override
299-
int get length => throw 'no details';
301+
int get length => throw _unsupportedErrorWithoutDetails;
300302

301303
@override
302-
int get invalidValue => throw 'no details';
304+
int get invalidValue => throw _unsupportedErrorWithoutDetails;
303305

304306
@override
305307
Object? get indexable => null;
@@ -335,3 +337,12 @@ class _LateErrorWithoutDetails extends _ErrorWithoutDetails
335337
implements LateError {
336338
const _LateErrorWithoutDetails(String message) : super(message);
337339
}
340+
341+
class _UnsupportedErrorWithoutDetails extends _ErrorWithoutDetails
342+
implements UnsupportedError {
343+
const _UnsupportedErrorWithoutDetails()
344+
: super('UnsupportedError (details omitted due to --minify)');
345+
346+
@override
347+
String get message => _message;
348+
}

0 commit comments

Comments
 (0)