Skip to content

[firebase_messaging] configure parameters do not surface Exceptions in flutter console #3288

Closed
@mintymac

Description

@mintymac

Describe the bug
Any runtime exceptions in the .configure named parameters do not show in the console. i.e. onMessage

To Reproduce
Steps to reproduce the behavior:

  1. Configure the onMessage parameter on the FirebaseMessaging class and throw any exception
_fcm.configure(
      onMessage: (Map<String, dynamic> pushMessage) async {
        print("onMessage: $pushMessage");
        throw (Exception(["Thrown in configure"]));
        await handleIncomingMessage(pushMessage);
      }
2. Send the device a push message via the fcm token 
3. Notice no Exception

**Expected behavior**
All exceptions not in try-catch constructs should be shown in the flutter console.

**Additional context**
Any code called from within this onMessage parameter will not surface exceptions

**Flutter doctor**
Run `flutter doctor` and paste the output below:
[✓] Flutter (Channel stable, 1.20.2, on Mac OS X 10.15.6 19G2021, locale en-US)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.47.3)
[✓] Connected device (2 available)

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions