refactoring
This commit is contained in:
@@ -33,8 +33,10 @@ class NotificationsBloc extends Bloc<NotificationsEvent, NotificationsState> {
|
||||
final nonLues = notifications.where((n) => !n.estLue).length;
|
||||
emit(NotificationsLoaded(notifications: notifications, nonLuesCount: nonLues));
|
||||
} on DioException catch (e) {
|
||||
if (e.type == DioExceptionType.cancel) return;
|
||||
emit(NotificationsError(_networkError(e)));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(NotificationsError('Erreur lors du chargement : $e'));
|
||||
}
|
||||
}
|
||||
@@ -70,6 +72,7 @@ class NotificationsBloc extends Bloc<NotificationsEvent, NotificationsState> {
|
||||
emit(NotificationMarkedAsRead(notifications: updated, nonLuesCount: nonLues));
|
||||
}
|
||||
} catch (e, st) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
AppLogger.error('NotificationsBloc: marquer comme lu échoué', error: e, stackTrace: st);
|
||||
emit(NotificationsError('Impossible de marquer comme lu'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user