Skip to content

Commit

Permalink
[mob] Reduce error severity (#2224)
Browse files Browse the repository at this point in the history
## Description

## Tests
  • Loading branch information
ua741 authored Jun 19, 2024
2 parents f78e01e + 9bf8e16 commit 477bc4c
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 13 deletions.
4 changes: 4 additions & 0 deletions mobile/lib/core/error-reporting/super_logging.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'dart:collection';
import 'dart:core';
import 'dart:io';

import "package:dio/dio.dart";
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:http/http.dart' as http;
Expand Down Expand Up @@ -230,6 +231,9 @@ class SuperLogging {
StackTrace? stack,
) async {
try {
if (error is DioError) {
return;
}
await Sentry.captureException(
error,
stackTrace: stack,
Expand Down
2 changes: 1 addition & 1 deletion mobile/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ Future<void> _sync(String caller) async {
await SyncService.instance.sync();
} catch (e, s) {
if (!isHandledSyncError(e)) {
_logger.severe("Sync error", e, s);
_logger.warning("Sync error", e, s);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion mobile/lib/services/collections_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ class CollectionsService {
collection.setName(newName);
sync().ignore();
} catch (e, s) {
_logger.severe("failed to rename collection", e, s);
_logger.warning("failed to rename collection", e, s);
rethrow;
}
}
Expand Down
12 changes: 6 additions & 6 deletions mobile/lib/services/user_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class UserService {
throw Exception("delete action failed");
}
} catch (e) {
_logger.severe(e);
_logger.warning(e);
await showGenericErrorDialog(context: context, error: e);
return null;
}
Expand Down Expand Up @@ -304,7 +304,7 @@ class UserService {
throw Exception("delete action failed");
}
} catch (e) {
_logger.severe(e);
_logger.warning(e);
rethrow;
}
}
Expand All @@ -329,7 +329,7 @@ class UserService {
}
rethrow;
} catch (e, s) {
_logger.severe("unexpected error", e, s);
_logger.warning("unexpected error", e, s);
rethrow;
}
}
Expand Down Expand Up @@ -366,7 +366,7 @@ class UserService {
Bus.instance.fire(AccountConfiguredEvent());
}
} catch (e) {
_logger.severe(e);
_logger.warning(e);
await dialog.hide();
await showGenericErrorDialog(context: context, error: e);
}
Expand Down Expand Up @@ -448,7 +448,7 @@ class UserService {
}
} catch (e) {
await dialog.hide();
_logger.severe(e);
_logger.warning(e);
// ignore: unawaited_futures
showErrorDialog(
context,
Expand Down Expand Up @@ -519,7 +519,7 @@ class UserService {
}
} catch (e) {
await dialog.hide();
_logger.severe(e);
_logger.warning(e);
// ignore: unawaited_futures
showErrorDialog(
context,
Expand Down
4 changes: 2 additions & 2 deletions mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
setState(() {});
}
} catch (e, s) {
_logger.severe("Failed to rename album", e, s);
_logger.warning("Failed to rename album", e, s);
rethrow;
}
},
Expand Down Expand Up @@ -610,7 +610,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
await dialog.hide();
Navigator.of(context).pop();
} catch (e, s) {
_logger.severe("failed to trash collection", e, s);
_logger.warning("failed to trash collection", e, s);
await dialog.hide();
await showGenericErrorDialog(context: context, error: e);
}
Expand Down
4 changes: 2 additions & 2 deletions mobile/lib/utils/file_uploader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class FileUploader {
kFileUploadTimeout,
onTimeout: () {
final message = "Upload timed out for file " + file.toString();
_logger.severe(message);
_logger.warning(message);
throw TimeoutException(message);
},
);
Expand Down Expand Up @@ -1184,7 +1184,7 @@ class FileUploader {
clearQueue(error);
throw error;
} else {
_logger.severe("Could not fetch upload URLs", e, s);
_logger.warning("Could not fetch upload URLs", e, s);
}
}
rethrow;
Expand Down
2 changes: 1 addition & 1 deletion mobile/lib/utils/file_uploader_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ Future<MediaUploadData> _getMediaUploadDataFromAppCache(EnteFile file) async {
width: dimensions?['width'],
);
} catch (e, s) {
_logger.severe("failed to generate thumbnail", e, s);
_logger.warning("failed to generate thumbnail", e, s);
throw InvalidFileError(
"thumbnail failed for appCache fileType: ${file.fileType.toString()}",
InvalidReason.thumbnailMissing,
Expand Down

0 comments on commit 477bc4c

Please sign in to comment.