felangel/bloc
refactor: stop losing the original stack trace from dart 2.16
Geschlossen
#2.995 geöffnet am 21.11.2021
examplegood first issuerefactor
Repository-Metriken
- Stars
- (12.452 Sterne)
- PR-Merge-Metriken
- (Durchschn. Merge 2T 22h) (5 gemergte PRs in 30 T)
Beschreibung
You must stop losing the original source stack trace like this (just for example):
it's big trouble, to read exceptions without source stacktraces, especially in crashlytics or sentry like logs
from dart 2.16 you must use Error.throwWithStackTrace like this:
//@dart=2.16
...
} on FirebaseAuthException catch (e, stackTrace) {
Error.throwWithStackTrace(
SignUpWithEmailAndPasswordFailure.fromCode(e.code),
stackTrace,
);
}
also, instead:
} catch (_) {
you must write:
} on Object {
or:
} on Object catch (error, stackTrace) {