File tree Expand file tree Collapse file tree
packages/_flutterfire_internals Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,12 +91,14 @@ FirebaseException _firebaseExceptionFromCoreFirebaseError(
9191///
9292/// See also https://github.com/dart-lang/sdk/issues/30741
9393bool _testException (Object ? objectException) {
94- final exception = objectException! as core_interop.JSError ;
94+ if (objectException is ! core_interop.JSError ) {
95+ return false ;
96+ }
9597
96- final message = _safeConvertFromPossibleJSObject (exception .message);
98+ final message = _safeConvertFromPossibleJSObject (objectException .message);
9799 // Firestore web does not contain `Firebase` in the message so we check the exception itself.
98100 return message.contains ('Firebase' ) ||
99- exception .toString ().contains ('FirebaseError' );
101+ objectException .toString ().contains ('FirebaseError' );
100102}
101103
102104/// Transforms internal errors in something more readable for end-users.
Original file line number Diff line number Diff line change @@ -52,6 +52,19 @@ void main() {
5252 expect (stack, current);
5353 }
5454 });
55+
56+ test (
57+ 'propagates plain Dart errors from Futures (e.g. ArgumentError on web)' ,
58+ () async {
59+ await expectLater (
60+ guardWebExceptions (
61+ () => Future <void >.error (ArgumentError ('test' )),
62+ plugin: 'test' ,
63+ codeParser: (c) => c,
64+ ),
65+ throwsA (isA <ArgumentError >()),
66+ );
67+ });
5568 });
5669}
5770
You can’t perform that action at this time.
0 commit comments