[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 <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
This commit is contained in:
Martin Kustermann
2025-06-23 05:53:09 -07:00
committed by Commit Queue
parent 150e8cbe97
commit cf43e2a573
+16 -5
View File
@@ -258,6 +258,8 @@ const _reachabilityError = _LateErrorWithoutDetails(
const _noSuchMethodErrorWithoutDetails = _NoSuchMethodErrorWithoutDetails();
const _unsupportedErrorWithoutDetails = _UnsupportedErrorWithoutDetails();
const typeErrorWithoutDetails = _TypeErrorWithoutDetails();
class _ErrorWithoutDetails implements Error {
@@ -278,7 +280,7 @@ class _ArgumentErrorWithoutDetails extends _ErrorWithoutDetails
String? get name => null;
@override
String get message => toString();
String get message => _message;
@override
dynamic get invalidValue => null;
@@ -290,16 +292,16 @@ class _IndexErrorWithoutDetails extends _ArgumentErrorWithoutDetails
: super('IndexError (details omitted due to --minify)');
@override
int get start => throw 'no details';
int get start => throw _unsupportedErrorWithoutDetails;
@override
int get end => throw 'no details';
int get end => throw _unsupportedErrorWithoutDetails;
@override
int get length => throw 'no details';
int get length => throw _unsupportedErrorWithoutDetails;
@override
int get invalidValue => throw 'no details';
int get invalidValue => throw _unsupportedErrorWithoutDetails;
@override
Object? get indexable => null;
@@ -335,3 +337,12 @@ class _LateErrorWithoutDetails extends _ErrorWithoutDetails
implements LateError {
const _LateErrorWithoutDetails(String message) : super(message);
}
class _UnsupportedErrorWithoutDetails extends _ErrorWithoutDetails
implements UnsupportedError {
const _UnsupportedErrorWithoutDetails()
: super('UnsupportedError (details omitted due to --minify)');
@override
String get message => _message;
}