Ignore flutter errors with no stack [skip ci]

This commit is contained in:
Omar
2026-05-12 21:38:21 +02:00
parent 2c245040c0
commit 491a692cd6
+13 -8
View File
@@ -117,7 +117,7 @@ class ExceptionHandler {
if (await onLedgerError(errorDetails)) return;
if (kDebugMode || kProfileMode) {
if(_ignoreError(errorDetails.exception.toString()) ||
if (_ignoreError(errorDetails.exception.toString()) ||
_ignoreError(errorDetails.stack.toString())) {
printV("(BELOW ERROR IS IGNORED AND WILL NOT TRIGGER POPUP IN PROD)");
}
@@ -127,7 +127,8 @@ class ExceptionHandler {
}
if (_ignoreError(errorDetails.exception.toString()) ||
_ignoreError(errorDetails.stack.toString())) {
_ignoreError(errorDetails.stack.toString()) ||
_flutterErrorIgnore(errorDetails)) {
return;
}
@@ -215,8 +216,7 @@ class ExceptionHandler {
return S.current.ledger_error_tx_rejected_by_user;
} else if (errorCode.contains("5515")) {
return S.current.ledger_error_device_locked;
} else
if (["6e01", "6d02", "6511", "6e00"].any((e) => errorCode.contains(e))) {
} else if (["6e01", "6d02", "6511", "6e00"].any((e) => errorCode.contains(e))) {
return S.current.ledger_error_wrong_app;
}
return null;
@@ -229,9 +229,8 @@ class ExceptionHandler {
context: navigatorKey.currentContext!,
builder: (context) => AlertWithOneAction(
alertTitle: "Ledger Error",
alertContent:
interpretErrorCode(errorDetails.exception.toString()) ??
S.of(context).ledger_connection_error,
alertContent: interpretErrorCode(errorDetails.exception.toString()) ??
S.of(context).ledger_connection_error,
buttonText: S.of(context).close,
buttonAction: () => Navigator.of(context).pop(),
),
@@ -296,7 +295,7 @@ class ExceptionHandler {
"Wallet is null",
"Wrong Device Status: 0x5515 (UNKNOWN)",
"Command handling failed. With error: hostUnreachable",
"FocusScopeNode was used after being disposed",
"_getDismissibleFlushbar",
"_QueuedFuture.execute (package:universal_ble/src/queue.dart:65)",
@@ -439,4 +438,10 @@ class ExceptionHandler {
_hasError = false;
}
static bool _flutterErrorIgnore(FlutterErrorDetails errorDetails) {
// most probably a flutter context error so just ignore it if there is no stack we can debug with
return errorDetails.exception.toString().contains("Null check operator used on a null value") &&
errorDetails.stack == null;
}
}