Skip to content

Commit

Permalink
Merge pull request #1801 from ardriveapp/PE-6471-refactor-on-error-me…
Browse files Browse the repository at this point in the history
…thod-at-drive-attach-cubit-to-avoid-stack-overflow-error-stack-overflow

PE-6471: refactor on error method at drive attach cubit to avoid stack overflow error stack overflow
  • Loading branch information
thiagocarvalhodev authored Jul 24, 2024
2 parents b359829 + 67de23a commit eade1ce
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/blocs/drive_attach/drive_attach_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ class DriveAttachCubit extends Cubit<DriveAttachState> {
PlausibleEventTracker.trackAttachDrive(
drivePrivacy: drivePrivacy,
);
} catch (err) {
addError(err);
} catch (err, stacktrace) {
_handleError(err, stacktrace);
}
}

Expand Down Expand Up @@ -249,11 +249,9 @@ class DriveAttachCubit extends Cubit<DriveAttachState> {
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());
}
}

0 comments on commit eade1ce

Please sign in to comment.