firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.44k stars 3.91k forks source link

fix(database, web): Stop transaction & stream handling exceptions from throwing twice #12706

Closed russellwheatley closed 3 weeks ago

russellwheatley commented 3 weeks ago

Description

  1. Removed transaction handler from throwing twice. This is the main fix in the PR because we were using two exception handlers so when the second exception was passed into convertFirebaseDatabaseException(), it would pass in an already formed FirebaseException and cause the users issue.
  2. Moved exception stream handling to the source so we can properly propagate exception without unhandled exception. We already have test catching exception, the problem here was an unhandled exception was also thown.
  3. Implemented the same logic for stream exception handling for once() API function.
  4. Wrote test for transaction exception handling.

Related Issues

closes https://github.com/firebase/flutterfire/issues/12675

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?