From 67de23ae9b43751d93484f3fcabca517e2ce214b Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:36:15 -0300 Subject: [PATCH] Update drive_attach_cubit.dart avoid addError and onError overrides --- lib/blocs/drive_attach/drive_attach_cubit.dart | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/blocs/drive_attach/drive_attach_cubit.dart b/lib/blocs/drive_attach/drive_attach_cubit.dart index b9912fa30c..d98b83c0da 100644 --- a/lib/blocs/drive_attach/drive_attach_cubit.dart +++ b/lib/blocs/drive_attach/drive_attach_cubit.dart @@ -154,8 +154,8 @@ class DriveAttachCubit extends Cubit { PlausibleEventTracker.trackAttachDrive( drivePrivacy: drivePrivacy, ); - } catch (err) { - addError(err); + } catch (err, stacktrace) { + _handleError(err, stacktrace); } } @@ -249,11 +249,9 @@ class DriveAttachCubit extends Cubit { return null; } - @override - void onError(Object error, StackTrace stackTrace) { - emit(DriveAttachFailure()); - super.onError(error, stackTrace); + void _handleError(Object error, StackTrace stackTrace) { + logger.e('Failed to attach drive. Emitting error', error, stackTrace); - logger.e('Failed to attach drive', error, stackTrace); + emit(DriveAttachFailure()); } }