Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Make error field mandatory

Neeraj Gupta1ec2b14df2d5
diff --git a/lib/models/search/search_types.dart b/lib/models/search/search_types.dart
index dc15bc1aef..189569e2ee 100644
--- a/lib/models/search/search_types.dart
+++ b/lib/models/search/search_types.dart
@@ -222,7 +222,7 @@ extension SectionTypeExtensions on SectionType {
},
);
if (result is Exception) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: result);
}
};
default:
diff --git a/lib/services/billing_service.dart b/lib/services/billing_service.dart
index 6891089e39..5b5c572580 100644
--- a/lib/services/billing_service.dart
+++ b/lib/services/billing_service.dart
@@ -196,7 +196,7 @@ class BillingService {
);
} catch (e) {
await dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
await dialog.hide();
}
diff --git a/lib/services/hidden_service.dart b/lib/services/hidden_service.dart
index 97c21af248..a90dbc0377 100644
--- a/lib/services/hidden_service.dart
+++ b/lib/services/hidden_service.dart
@@ -154,7 +154,7 @@ extension HiddenService on CollectionsService {
} catch (e, s) {
_logger.severe("Could not hide", e, s);
await dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
return false;
} finally {
await dialog.hide();
diff --git a/lib/services/user_service.dart b/lib/services/user_service.dart
index c5b14a305c..954891fd30 100644
--- a/lib/services/user_service.dart
+++ b/lib/services/user_service.dart
@@ -113,8 +113,9 @@ class UserService {
),
);
return;
+ } else {
+ throw Exception("send-ott action failed, non-200");
}
- unawaited(showGenericErrorDialog(context: context));
} on DioError catch (e) {
await dialog.hide();
_logger.info(e);
@@ -261,7 +262,7 @@ class UserService {
//to close and only then to show the error dialog.
Future.delayed(
const Duration(milliseconds: 150),
- () => showGenericErrorDialog(context: context),
+ () => showGenericErrorDialog(context: context, error: null),
);
}
}
@@ -281,7 +282,7 @@ class UserService {
}
} catch (e) {
_logger.severe(e);
- await showGenericErrorDialog(context: context);
+ await showGenericErrorDialog(context: context, error: e);
return null;
}
}
@@ -958,7 +959,7 @@ class UserService {
try {
recoveryKey = await getOrCreateRecoveryKey(context);
} catch (e) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
return false;
}
final dialog = createProgressDialog(context, S.of(context).verifying);
diff --git a/lib/ui/account/delete_account_page.dart b/lib/ui/account/delete_account_page.dart
index 9c1ecdfd15..8d031deed7 100644
--- a/lib/ui/account/delete_account_page.dart
+++ b/lib/ui/account/delete_account_page.dart
@@ -262,7 +262,7 @@ class _DeleteAccountPageState extends State<DeleteAccountPage> {
isDismissible: false,
);
if (choice!.action == ButtonAction.error) {
- await showGenericErrorDialog(context: context);
+ await showGenericErrorDialog(context: context, error: choice.exception);
}
}
@@ -289,7 +289,7 @@ class _DeleteAccountPageState extends State<DeleteAccountPage> {
showShortToast(context, S.of(context).yourAccountHasBeenDeleted);
} catch (e, s) {
Logger("DeleteAccount").severe("failed to delete", e, s);
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
}
diff --git a/lib/ui/account/password_entry_page.dart b/lib/ui/account/password_entry_page.dart
index f148ef21eb..5da5cd03a7 100644
--- a/lib/ui/account/password_entry_page.dart
+++ b/lib/ui/account/password_entry_page.dart
@@ -404,7 +404,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
} catch (e, s) {
_logger.severe(e, s);
await dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
}
@@ -456,7 +456,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
} catch (e, s) {
_logger.severe(e, s);
await dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
}
@@ -481,7 +481,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
S.of(context).sorryWeCouldNotGenerateSecureKeysOnThisDevicennplease,
);
} else {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
}
}
diff --git a/lib/ui/account/verify_recovery_page.dart b/lib/ui/account/verify_recovery_page.dart
index baca1a987a..c22aee355d 100644
--- a/lib/ui/account/verify_recovery_page.dart
+++ b/lib/ui/account/verify_recovery_page.dart
@@ -51,7 +51,7 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
"Please check your internet connection and try again.",
);
} else {
- await showGenericErrorDialog(context: context);
+ await showGenericErrorDialog(context: context, error: e);
}
return;
}
@@ -109,7 +109,7 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
),
);
} catch (e) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
return;
}
}
diff --git a/lib/ui/actions/collection/collection_file_actions.dart b/lib/ui/actions/collection/collection_file_actions.dart
index b89f44b80c..c46003b20b 100644
--- a/lib/ui/actions/collection/collection_file_actions.dart
+++ b/lib/ui/actions/collection/collection_file_actions.dart
@@ -73,7 +73,7 @@ extension CollectionFileActions on CollectionActions {
);
if (actionResult?.action != null &&
actionResult!.action == ButtonAction.error) {
- showGenericErrorDialog(context: bContext);
+ showGenericErrorDialog(context: bContext, error: actionResult.exception);
} else {
selectedFiles.clearAll();
}
@@ -187,7 +187,7 @@ extension CollectionFileActions on CollectionActions {
} catch (e, s) {
logger.severe("Failed to add to album", e, s);
await dialog?.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
rethrow;
}
}
diff --git a/lib/ui/actions/collection/collection_sharing_actions.dart b/lib/ui/actions/collection/collection_sharing_actions.dart
index 970189c312..f4656fe153 100644
--- a/lib/ui/actions/collection/collection_sharing_actions.dart
+++ b/lib/ui/actions/collection/collection_sharing_actions.dart
@@ -52,7 +52,7 @@ class CollectionActions {
_showUnSupportedAlert(context);
} else {
logger.severe("Failed to update shareUrl collection", e);
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
return false;
}
@@ -93,7 +93,7 @@ class CollectionActions {
);
if (actionResult?.action != null) {
if (actionResult!.action == ButtonAction.error) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: actionResult.exception);
}
return actionResult.action == ButtonAction.first;
} else {
@@ -142,7 +142,7 @@ class CollectionActions {
return collection;
} catch (e, s) {
dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
logger.severe("Failing to create link for selected files", e, s);
}
return null;
@@ -183,7 +183,7 @@ class CollectionActions {
);
if (actionResult?.action != null) {
if (actionResult!.action == ButtonAction.error) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: actionResult.exception);
}
return actionResult.action == ButtonAction.first;
}
@@ -230,7 +230,7 @@ class CollectionActions {
} catch (e) {
await dialog?.hide();
logger.severe("Failed to get public key", e);
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
return false;
}
// getPublicKey can return null when no user is associated with given
@@ -272,7 +272,7 @@ class CollectionActions {
_showUnSupportedAlert(context);
} else {
logger.severe("failed to share collection", e);
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
return false;
}
@@ -353,7 +353,7 @@ class CollectionActions {
);
if (actionResult?.action != null &&
actionResult!.action == ButtonAction.error) {
- showGenericErrorDialog(context: bContext);
+ showGenericErrorDialog(context: bContext, error: actionResult.exception);
return false;
}
if ((actionResult?.action != null) &&
diff --git a/lib/ui/actions/file/file_actions.dart b/lib/ui/actions/file/file_actions.dart
index 147c6ba23e..695c534062 100644
--- a/lib/ui/actions/file/file_actions.dart
+++ b/lib/ui/actions/file/file_actions.dart
@@ -125,7 +125,7 @@ Future<void> showSingleFileDeleteSheet(
);
if (actionResult?.action != null &&
actionResult!.action == ButtonAction.error) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: actionResult.exception);
}
}
diff --git a/lib/ui/collections/album/vertical_list.dart b/lib/ui/collections/album/vertical_list.dart
index f95b1c2acd..c926c8b66d 100644
--- a/lib/ui/collections/album/vertical_list.dart
+++ b/lib/ui/collections/album/vertical_list.dart
@@ -111,6 +111,7 @@ class AlbumVerticalListWidget extends StatelessWidget {
if (result is Exception) {
showGenericErrorDialog(
context: context,
+ error: result,
);
_logger.severe(
"Failed to name album",
@@ -310,7 +311,7 @@ class AlbumVerticalListWidget extends StatelessWidget {
);
return true;
} catch (e) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
return false;
}
}
@@ -333,7 +334,7 @@ class AlbumVerticalListWidget extends StatelessWidget {
),
);
} else {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: result);
_logger.severe("Cannot share collections owned by others");
}
}
@@ -352,7 +353,10 @@ class AlbumVerticalListWidget extends StatelessWidget {
),
);
} else {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(
+ context: context,
+ error: Exception("Can not share collection owned by others"),
+ );
_logger.severe("Cannot share collections owned by others");
}
return Future.value(true);
@@ -409,7 +413,7 @@ class AlbumVerticalListWidget extends StatelessWidget {
} catch (e, s) {
_logger.severe("Could not move to album", e, s);
await dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
return false;
}
}
@@ -438,7 +442,7 @@ class AlbumVerticalListWidget extends StatelessWidget {
} catch (e, s) {
_logger.severe("Could not move to album", e, s);
await dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
return false;
}
}
diff --git a/lib/ui/collections/new_album_icon.dart b/lib/ui/collections/new_album_icon.dart
index dddf81cf5c..966685cd1c 100644
--- a/lib/ui/collections/new_album_icon.dart
+++ b/lib/ui/collections/new_album_icon.dart
@@ -55,7 +55,7 @@ class NewAlbumIcon extends StatelessWidget {
},
);
if (result is Exception) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: result);
}
},
);
diff --git a/lib/ui/components/buttons/button_widget.dart b/lib/ui/components/buttons/button_widget.dart
index 63054bca3d..ed6e53165e 100644
--- a/lib/ui/components/buttons/button_widget.dart
+++ b/lib/ui/components/buttons/button_widget.dart
@@ -498,7 +498,7 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
} else if (exception != null) {
//This is to show the execution was unsuccessful if the dialog is manually
//closed before the execution completes.
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: exception);
}
}
}
diff --git a/lib/ui/home/memories/full_screen_memory.dart b/lib/ui/home/memories/full_screen_memory.dart
index 8ead1ad699..7fb2a330d8 100644
--- a/lib/ui/home/memories/full_screen_memory.dart
+++ b/lib/ui/home/memories/full_screen_memory.dart
@@ -36,7 +36,7 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
bool _showCounter = false;
bool _showStepIndicator = true;
PageController? _pageController;
- bool _shouldDisableScroll = false;
+ final bool _shouldDisableScroll = false;
late int currentUserID;
final GlobalKey shareButtonKey = GlobalKey();
diff --git a/lib/ui/payment/child_subscription_widget.dart b/lib/ui/payment/child_subscription_widget.dart
index d9826021a6..2b61d3cf95 100644
--- a/lib/ui/payment/child_subscription_widget.dart
+++ b/lib/ui/payment/child_subscription_widget.dart
@@ -123,7 +123,7 @@ class ChildSubscriptionWidget extends StatelessWidget {
},
);
if (choice!.action == ButtonAction.error) {
- await showGenericErrorDialog(context: context);
+ await showGenericErrorDialog(context: context, error: choice.exception);
}
}
}
diff --git a/lib/ui/payment/payment_web_page.dart b/lib/ui/payment/payment_web_page.dart
index a5cd71a9e4..5bba834d5d 100644
--- a/lib/ui/payment/payment_web_page.dart
+++ b/lib/ui/payment/payment_web_page.dart
@@ -190,7 +190,10 @@ class _PaymentWebPageState extends State<PaymentWebPage> {
} else {
// should never reach here
_logger.severe("unexpected status", uri.toString());
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(
+ context: context,
+ error: Exception("expected payment status $paymentStatus"),
+ );
}
}
diff --git a/lib/ui/payment/store_subscription_page.dart b/lib/ui/payment/store_subscription_page.dart
index 722d6d5d22..abeeb8b12d 100644
--- a/lib/ui/payment/store_subscription_page.dart
+++ b/lib/ui/payment/store_subscription_page.dart
@@ -524,11 +524,14 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
final ProductDetailsResponse response =
await InAppPurchase.instance.queryProductDetails({productID});
if (response.notFoundIDs.isNotEmpty) {
- _logger.severe(
- "Could not find products: " + response.notFoundIDs.toString(),
- );
+ final errMsg = "Could not find products: " +
+ response.notFoundIDs.toString();
+ _logger.severe(errMsg);
await _dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(
+ context: context,
+ error: Exception(errMsg),
+ );
return;
}
final isCrossGradingOnAndroid = Platform.isAndroid &&
diff --git a/lib/ui/payment/stripe_subscription_page.dart b/lib/ui/payment/stripe_subscription_page.dart
index e205fb062b..d7354ba22b 100644
--- a/lib/ui/payment/stripe_subscription_page.dart
+++ b/lib/ui/payment/stripe_subscription_page.dart
@@ -337,7 +337,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
).then((value) => onWebPaymentGoBack);
} catch (e) {
await _dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
await _dialog.hide();
}
diff --git a/lib/ui/settings/backup/backup_folder_selection_page.dart b/lib/ui/settings/backup/backup_folder_selection_page.dart
index f20dc48bbf..810e1ee13b 100644
--- a/lib/ui/settings/backup/backup_folder_selection_page.dart
+++ b/lib/ui/settings/backup/backup_folder_selection_page.dart
@@ -232,7 +232,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
} catch (e, s) {
_logger.severe("Failed to updated backup folder", e, s);
await dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
}
diff --git a/lib/ui/settings/backup/backup_section_widget.dart b/lib/ui/settings/backup/backup_section_widget.dart
index 2ecefe8482..7b05da8bcd 100644
--- a/lib/ui/settings/backup/backup_section_widget.dart
+++ b/lib/ui/settings/backup/backup_section_widget.dart
@@ -94,7 +94,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
try {
status = await SyncService.instance.getBackupStatus();
} catch (e) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
return;
}
@@ -128,7 +128,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
duplicates =
await DeduplicationService.instance.getDuplicateFiles();
} catch (e) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
return;
}
diff --git a/lib/ui/settings/security_section_widget.dart b/lib/ui/settings/security_section_widget.dart
index 970cd3c808..7805167f94 100644
--- a/lib/ui/settings/security_section_widget.dart
+++ b/lib/ui/settings/security_section_widget.dart
@@ -89,7 +89,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
try {
recoveryKey = await _getOrCreateRecoveryKey(context);
} catch (e) {
- await showGenericErrorDialog(context: context);
+ await showGenericErrorDialog(context: context, error: e);
return;
}
unawaited(
@@ -260,14 +260,22 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
await UserService.instance.getOrCreateRecoveryKey(context),
);
}
+
Future<void> updateEmailMFA(bool isEnabled) async {
try {
- final UserDetails details = await UserService.instance.getUserDetailsV2(memoryCount: false);
- if((details.profileData?.canDisableEmailMFA ?? false) == false) {
- await routeToPage(context, RequestPasswordVerificationPage(onPasswordVerified: (Uint8List keyEncryptionKey) async {
- final Uint8List loginKey = await CryptoUtil.deriveLoginKey(keyEncryptionKey);
- await UserService.instance.registerOrUpdateSrp(loginKey);
- },),);
+ final UserDetails details =
+ await UserService.instance.getUserDetailsV2(memoryCount: false);
+ if ((details.profileData?.canDisableEmailMFA ?? false) == false) {
+ await routeToPage(
+ context,
+ RequestPasswordVerificationPage(
+ onPasswordVerified: (Uint8List keyEncryptionKey) async {
+ final Uint8List loginKey =
+ await CryptoUtil.deriveLoginKey(keyEncryptionKey);
+ await UserService.instance.registerOrUpdateSrp(loginKey);
+ },
+ ),
+ );
}
await UserService.instance.updateEmailMFA(isEnabled);
} catch (e) {
diff --git a/lib/ui/sharing/manage_album_participant.dart b/lib/ui/sharing/manage_album_participant.dart
index f07d34f6e9..7c6f33d569 100644
--- a/lib/ui/sharing/manage_album_participant.dart
+++ b/lib/ui/sharing/manage_album_participant.dart
@@ -132,7 +132,7 @@ class _ManageIndividualParticipantState
CollectionParticipantRole.viewer,
);
} catch (e) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
if (isConvertToViewSuccess && mounted) {
// reset value
diff --git a/lib/ui/sharing/manage_links_widget.dart b/lib/ui/sharing/manage_links_widget.dart
index 7377a8f68e..8468670290 100644
--- a/lib/ui/sharing/manage_links_widget.dart
+++ b/lib/ui/sharing/manage_links_widget.dart
@@ -347,7 +347,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
}
} catch (e) {
await dialog?.hide();
- await showGenericErrorDialog(context: context);
+ await showGenericErrorDialog(context: context, error: e);
rethrow;
}
}
diff --git a/lib/ui/sharing/pickers/device_limit_picker_page.dart b/lib/ui/sharing/pickers/device_limit_picker_page.dart
index ca7a89f4a8..de409ad39b 100644
--- a/lib/ui/sharing/pickers/device_limit_picker_page.dart
+++ b/lib/ui/sharing/pickers/device_limit_picker_page.dart
@@ -137,7 +137,7 @@ class _ItemsWidgetState extends State<ItemsWidget> {
try {
await CollectionsService.instance.updateShareUrl(widget.collection, prop);
} catch (e) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
rethrow;
}
}
diff --git a/lib/ui/sharing/pickers/link_expiry_picker_page.dart b/lib/ui/sharing/pickers/link_expiry_picker_page.dart
index 8ca0f5bf71..0e04e1a7fd 100644
--- a/lib/ui/sharing/pickers/link_expiry_picker_page.dart
+++ b/lib/ui/sharing/pickers/link_expiry_picker_page.dart
@@ -180,7 +180,7 @@ class _ItemsWidgetState extends State<ItemsWidget> {
try {
await CollectionsService.instance.updateShareUrl(widget.collection, prop);
} catch (e) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
rethrow;
}
}
diff --git a/lib/ui/viewer/file/file_app_bar.dart b/lib/ui/viewer/file/file_app_bar.dart
index ebcc06c934..d52d8ed146 100644
--- a/lib/ui/viewer/file/file_app_bar.dart
+++ b/lib/ui/viewer/file/file_app_bar.dart
@@ -288,7 +288,7 @@ class FileAppBarState extends State<FileAppBar> {
}
} catch (e, s) {
_logger.severe("failed to update file visibility", e, s);
- await showGenericErrorDialog(context: context);
+ await showGenericErrorDialog(context: context, error: e);
}
}
@@ -371,7 +371,7 @@ class FileAppBarState extends State<FileAppBar> {
} catch (e) {
_logger.warning("Failed to save file", e);
await dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
} finally {
PhotoManager.startChangeNotify();
LocalSyncService.instance.checkAndSync().ignore();
@@ -432,7 +432,7 @@ class FileAppBarState extends State<FileAppBar> {
} catch (e) {
dialog.hide();
_logger.severe("Failed to use as", e);
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
}
}
diff --git a/lib/ui/viewer/gallery/empty_album_state.dart b/lib/ui/viewer/gallery/empty_album_state.dart
index d8e985e59f..0ec5b07567 100644
--- a/lib/ui/viewer/gallery/empty_album_state.dart
+++ b/lib/ui/viewer/gallery/empty_album_state.dart
@@ -31,7 +31,7 @@ class EmptyAlbumState extends StatelessWidget {
try {
await showAddPhotosSheet(context, c);
} catch (e) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
},
),
diff --git a/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index b23780edf1..a1dde81f14 100644
--- a/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -172,7 +172,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
},
);
if (result is Exception) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: result);
}
}
@@ -204,7 +204,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
);
if (actionResult?.action != null && mounted) {
if (actionResult!.action == ButtonAction.error) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: actionResult.exception);
} else if (actionResult.action == ButtonAction.first) {
Navigator.of(context).pop();
}
@@ -224,7 +224,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
.getBackupStatus(pathID: widget.deviceCollection!.id);
} catch (e) {
await dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
return;
}
@@ -664,7 +664,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
} catch (e, s) {
_logger.severe("failed to trash collection", e, s);
await dialog.hide();
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
} else {
final bool result = await collectionActions.deleteCollectionSheet(
@@ -691,7 +691,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
}
} catch (e, s) {
_logger.severe("failed to trash collection", e, s);
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
}
@@ -726,7 +726,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
}
} catch (e, s) {
_logger.severe(e, s);
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
}
@@ -736,7 +736,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
await showAddPhotosSheet(bContext, collection!);
} catch (e, s) {
_logger.severe(e, s);
- showGenericErrorDialog(context: bContext);
+ showGenericErrorDialog(context: bContext, error: e);
}
}
diff --git a/lib/ui/viewer/location/location_screen.dart b/lib/ui/viewer/location/location_screen.dart
index 8e82a19912..5ff279288f 100644
--- a/lib/ui/viewer/location/location_screen.dart
+++ b/lib/ui/viewer/location/location_screen.dart
@@ -118,7 +118,7 @@ class LocationScreenPopUpMenu extends StatelessWidget {
);
Navigator.of(context).pop();
} catch (e) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
}
}
},
diff --git a/lib/ui/viewer/location/radius_picker_widget.dart b/lib/ui/viewer/location/radius_picker_widget.dart
index 7d17437a43..d353340e32 100644
--- a/lib/ui/viewer/location/radius_picker_widget.dart
+++ b/lib/ui/viewer/location/radius_picker_widget.dart
@@ -200,7 +200,7 @@ class _RadiusPickerWidgetState extends State<RadiusPickerWidget> {
alignMessage: Alignment.centerRight,
);
if (result is Exception) {
- await showGenericErrorDialog(context: context);
+ await showGenericErrorDialog(context: context, error: result);
_logger.severe(
"Failed to create custom radius",
result,
diff --git a/lib/utils/delete_file_util.dart b/lib/utils/delete_file_util.dart
index c92210d89d..1128887a20 100644
--- a/lib/utils/delete_file_util.dart
+++ b/lib/utils/delete_file_util.dart
@@ -102,7 +102,7 @@ Future<void> deleteFilesFromEverywhere(
await FilesDB.instance.deleteMultipleUploadedFiles(fileIDs);
} catch (e) {
_logger.severe(e);
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
rethrow;
}
for (final collectionID in updatedCollectionIDs) {
@@ -163,7 +163,7 @@ Future<void> deleteFilesFromRemoteOnly(
await FilesDB.instance.deleteMultipleUploadedFiles(uploadedFileIDs);
} catch (e, s) {
_logger.severe("Failed to delete files from remote", e, s);
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
rethrow;
}
for (final collectionID in updatedCollectionIDs) {
@@ -279,7 +279,10 @@ Future<bool> deleteFromTrash(BuildContext context, List<EnteFile> files) async {
actionResult!.action == ButtonAction.cancel) {
return didDeletionStart ? true : false;
} else if (actionResult.action == ButtonAction.error) {
- await showGenericErrorDialog(context: context);
+ await showGenericErrorDialog(
+ context: context,
+ error: actionResult.exception,
+ );
return false;
} else {
return true;
@@ -306,7 +309,10 @@ Future<bool> emptyTrash(BuildContext context) async {
actionResult!.action == ButtonAction.cancel) {
return false;
} else if (actionResult.action == ButtonAction.error) {
- await showGenericErrorDialog(context: context);
+ await showGenericErrorDialog(
+ context: context,
+ error: actionResult.exception,
+ );
return false;
} else {
return true;
@@ -555,7 +561,7 @@ Future<void> showDeleteSheet(
showShortToast(context, S.of(context).movedToTrash);
},
onError: (e, s) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: e);
},
);
},
@@ -620,7 +626,7 @@ Future<void> showDeleteSheet(
);
if (actionResult?.action != null &&
actionResult!.action == ButtonAction.error) {
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: actionResult.exception);
} else {
selectedFiles.clearAll();
}
diff --git a/lib/utils/dialog_util.dart b/lib/utils/dialog_util.dart
index 0cb267b9c6..80e69ed572 100644
--- a/lib/utils/dialog_util.dart
+++ b/lib/utils/dialog_util.dart
@@ -121,7 +121,7 @@ String parseErrorForUI(
Future<ButtonResult?> showGenericErrorDialog({
required BuildContext context,
bool isDismissible = true,
- Object? error,
+ required Object? error,
}) async {
final errorBody = parseErrorForUI(
context,
diff --git a/lib/utils/magic_util.dart b/lib/utils/magic_util.dart
index 4c12af720c..fc5fef9bcc 100644
--- a/lib/utils/magic_util.dart
+++ b/lib/utils/magic_util.dart
@@ -218,7 +218,7 @@ Future<void> editFilename(
);
if (result is Exception) {
_logger.severe("Failed to rename file");
- showGenericErrorDialog(context: context);
+ showGenericErrorDialog(context: context, error: result);
}
}
diff --git a/lib/utils/share_util.dart b/lib/utils/share_util.dart
index bcd18aa0d0..c8750490f3 100644
--- a/lib/utils/share_util.dart
+++ b/lib/utils/share_util.dart
@@ -74,7 +74,7 @@ Future<void> share(
s,
);
await dialog.hide();
- await showGenericErrorDialog(context: context);
+ await showGenericErrorDialog(context: context, error: e);
}
}