guard crashlytics call in error handler for test environments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5be231da73
commit
c58c9a9a25
1 changed files with 9 additions and 5 deletions
|
|
@ -179,11 +179,15 @@ abstract class BaseApiClient {
|
|||
if (exception is ServerException ||
|
||||
error.type == DioExceptionType.unknown ||
|
||||
error.type == DioExceptionType.badCertificate) {
|
||||
FirebaseCrashlytics.instance.recordError(
|
||||
exception,
|
||||
error.stackTrace,
|
||||
reason: '${error.requestOptions.method} ${error.requestOptions.uri}',
|
||||
);
|
||||
try {
|
||||
FirebaseCrashlytics.instance.recordError(
|
||||
exception,
|
||||
error.stackTrace,
|
||||
reason: '${error.requestOptions.method} ${error.requestOptions.uri}',
|
||||
);
|
||||
} catch (_) {
|
||||
// Firebase may not be initialized (e.g., in tests).
|
||||
}
|
||||
}
|
||||
|
||||
return exception;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue