Skip to content

armgit / ente

Public Imported from GitHub
0

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

err 1

Manav Rathiffc1db7369d4
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index 44d51eab81..5aefa1cb72 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -15,6 +15,7 @@ if (process.env.NEXT_PUBLIC_ENTE_WIP_PS5) {
import { isDesktop } from "@/base/app";
import { type ModalVisibilityProps } from "@/base/components/utils/modal";
+import { useBaseContext } from "@/base/context";
import { lowercaseExtension } from "@/base/file-name";
import type { LocalUser } from "@/base/local-user";
import log from "@/base/log";
@@ -159,6 +160,8 @@ const FileViewer: React.FC<FileViewerProps> = ({
onSelectPerson,
onSaveEditedImageCopy,
}) => {
+ const { onGenericError } = useBaseContext();
+
// There are 3 things involved in this dance:
//
// 1. Us, "FileViewer". We're a React component.
@@ -306,7 +309,12 @@ const FileViewer: React.FC<FileViewerProps> = ({
if (!showModifyActions || !favoriteFileIDs)
throw new Error("Unexpected invocation");
- await new Promise((r) => setTimeout(r, 7000));
+ try {
+ await new Promise((r) => setTimeout(r, 3000));
+ throw new Error("test");
+ } catch (e) {
+ onGenericError(e);
+ }
console.log({ file, annotation });
// TODO
// const isFavorite = annotation.isFavorite;
@@ -323,7 +331,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
// onMarkUnsyncedFavoriteUpdate(file.id, undefined);
// });
},
- [showModifyActions, favoriteFileIDs],
+ [showModifyActions, onGenericError, favoriteFileIDs],
);
// Initial value of delegate.
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index d6dbd2997f..d7f63e69d3 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -90,7 +90,11 @@ export interface FileViewerPhotoSwipeDelegate {
* Called when the user activates the toggle favorite action on a file.
*
* The toggle favorite button will be disabled for the file until the
- * promise returned by this function returns settles.
+ * promise returned by this function returns fulfills.
+ *
+ * > Note: The caller is expected to handle any errors that occur, and
+ * > should not reject for foreseeable failures, otherwise the button will
+ * > remain in the disabled state (until the file viewer is closed).
*/
toggleFavorite: (annotatedFile: FileViewerAnnotatedFile) => Promise<void>;
}