Skip to content

armgit / ente

Public Imported from GitHub
0

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

Unused and inline

Manav Rathif749f9de6513
diff --git a/web/apps/photos/src/services/collectionService.ts b/web/apps/photos/src/services/collectionService.ts
index 6d466336c3..ac8e02f5d5 100644
--- a/web/apps/photos/src/services/collectionService.ts
+++ b/web/apps/photos/src/services/collectionService.ts
@@ -34,7 +34,6 @@ import { getLocalFiles, sortFiles } from "@/new/photos/services/files";
import { updateMagicMetadata } from "@/new/photos/services/magic-metadata";
import type { FamilyData } from "@/new/photos/services/user-details";
import { batch } from "@/utils/array";
-import { CustomError } from "@ente/shared/error";
import HTTPService from "@ente/shared/network/HTTPService";
import localForage from "@ente/shared/storage/localForage";
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
@@ -423,7 +422,7 @@ export const removeFromFavorites = async (file: EnteFile) => {
try {
const favCollection = await getFavCollection();
if (!favCollection) {
- throw Error(CustomError.FAV_COLLECTION_MISSING);
+ throw Error("favorite collection missing");
}
await removeFromCollection(favCollection.id, [file]);
} catch (e) {
diff --git a/web/apps/photos/src/services/upload/uploadManager.ts b/web/apps/photos/src/services/upload/uploadManager.ts
index 3838e10548..8330bb6718 100644
--- a/web/apps/photos/src/services/upload/uploadManager.ts
+++ b/web/apps/photos/src/services/upload/uploadManager.ts
@@ -259,7 +259,7 @@ class UIService {
) {
const cancel: { exec: Canceler } = { exec: () => {} };
const cancelTimedOutRequest = () =>
- cancel.exec(CustomError.REQUEST_TIMEOUT);
+ cancel.exec("Request timed out");
const cancelCancelledUploadRequest = () =>
cancel.exec(CustomError.UPLOAD_CANCELLED);
diff --git a/web/apps/photos/src/utils/collection.ts b/web/apps/photos/src/utils/collection.ts
index 0a6761bde5..9a5072538d 100644
--- a/web/apps/photos/src/utils/collection.ts
+++ b/web/apps/photos/src/utils/collection.ts
@@ -19,7 +19,6 @@ import {
import { getAllLocalFiles, getLocalFiles } from "@/new/photos/services/files";
import { updateMagicMetadata } from "@/new/photos/services/magic-metadata";
import { safeDirectoryName } from "@/new/photos/utils/native-fs";
-import { CustomError } from "@ente/shared/error";
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
import type { User } from "@ente/shared/user/types";
import bs58 from "bs58";
@@ -74,7 +73,7 @@ export async function handleCollectionOps(
await unhideToCollection(collection, selectedFiles);
break;
default:
- throw Error(CustomError.INVALID_COLLECTION_OPERATION);
+ throw Error("Invalid collection operation");
}
}
diff --git a/web/packages/accounts/services/passkey.ts b/web/packages/accounts/services/passkey.ts
index 6e781163ef..ac68f470b0 100644
--- a/web/packages/accounts/services/passkey.ts
+++ b/web/packages/accounts/services/passkey.ts
@@ -7,7 +7,6 @@ import { accountsAppOrigin, apiURL } from "@/base/origins";
import { TwoFactorAuthorizationResponse } from "@/base/types/credentials";
import { ensure } from "@/utils/ensure";
import { getRecoveryKey } from "@ente/shared/crypto/helpers";
-import { CustomError } from "@ente/shared/error";
import HTTPService from "@ente/shared/network/HTTPService";
import {
getData,
@@ -141,7 +140,7 @@ export const isPasskeyRecoveryEnabled = async () => {
);
if (typeof resp.data === "undefined") {
- throw Error(CustomError.REQUEST_FAILED);
+ throw Error("request failed");
}
return resp.data["isPasskeyRecoveryEnabled"] as boolean;
@@ -173,7 +172,7 @@ const configurePasskeyRecovery = async (
);
if (typeof resp.data === "undefined") {
- throw Error(CustomError.REQUEST_FAILED);
+ throw Error("request failed");
}
} catch (e) {
log.error("failed to configure passkey recovery", e);
diff --git a/web/packages/new/photos/services/download.ts b/web/packages/new/photos/services/download.ts
index 5bbd18ba95..2da7a4c5e7 100644
--- a/web/packages/new/photos/services/download.ts
+++ b/web/packages/new/photos/services/download.ts
@@ -661,7 +661,7 @@ class PhotosDownloadClient implements DownloadClient {
};
const resp = await retryAsyncFunction(getThumbnail);
- if (resp.data === undefined) throw Error(CustomError.REQUEST_FAILED);
+ if (resp.data === undefined) throw Error("request failed");
// TODO: Remove this cast (it won't be needed when we migrate this from
// axios to fetch).
return new Uint8Array(resp.data as ArrayBuffer);
@@ -703,7 +703,7 @@ class PhotosDownloadClient implements DownloadClient {
};
const resp = await retryAsyncFunction(getFile);
- if (resp.data === undefined) throw Error(CustomError.REQUEST_FAILED);
+ if (resp.data === undefined) throw Error("request failed");
// TODO: Remove this cast (it won't be needed when we migrate this from
// axios to fetch).
return new Uint8Array(resp.data as ArrayBuffer);
@@ -820,7 +820,7 @@ class PublicAlbumsDownloadClient implements DownloadClient {
};
const resp = await getThumbnail();
- if (resp.data === undefined) throw Error(CustomError.REQUEST_FAILED);
+ if (resp.data === undefined) throw Error("request failed");
// TODO: Remove this cast (it won't be needed when we migrate this from
// axios to fetch).
return new Uint8Array(resp.data as ArrayBuffer);
@@ -871,7 +871,7 @@ class PublicAlbumsDownloadClient implements DownloadClient {
};
const resp = await retryAsyncFunction(getFile);
- if (resp.data === undefined) throw Error(CustomError.REQUEST_FAILED);
+ if (resp.data === undefined) throw Error("request failed");
// TODO: Remove this cast (it won't be needed when we migrate this from
// axios to fetch).
return new Uint8Array(resp.data as ArrayBuffer);
diff --git a/web/packages/shared/error/index.ts b/web/packages/shared/error/index.ts
index a4ad88e45a..e7b72d2846 100644
--- a/web/packages/shared/error/index.ts
+++ b/web/packages/shared/error/index.ts
@@ -29,32 +29,20 @@ export const CustomError = {
SUBSCRIPTION_EXPIRED: "subscription expired",
STORAGE_QUOTA_EXCEEDED: "storage quota exceeded",
SESSION_EXPIRED: "session expired",
- FAV_COLLECTION_MISSING: "favorite collection missing",
- INVALID_COLLECTION_OPERATION: "invalid collection operation",
- REQUEST_FAILED: "request failed",
TOKEN_EXPIRED: "token expired",
TOKEN_MISSING: "token missing",
TOO_MANY_REQUESTS: "too many requests",
BAD_REQUEST: "bad request",
SUBSCRIPTION_NEEDED: "subscription not present",
NOT_FOUND: "not found ",
- NO_METADATA: "no metadata",
- FILE_ID_NOT_FOUND: "file with id not found",
WEAK_DEVICE: "password decryption failed on the device",
INCORRECT_PASSWORD: "incorrect password",
UPLOAD_CANCELLED: "upload cancelled",
- REQUEST_TIMEOUT: "request taking too long",
- HIDDEN_COLLECTION_SYNC_FILE_ATTEMPTED:
- "hidden collection sync file attempted",
UNKNOWN_ERROR: "Something went wrong, please try again",
- NETWORK_ERROR: "Network Error",
UPDATE_EXPORTED_RECORD_FAILED: "update file exported record failed",
EXPORT_STOPPED: "export stopped",
- NO_EXPORT_FOLDER_SELECTED: "no export folder selected",
EXPORT_FOLDER_DOES_NOT_EXIST: "export folder does not exist",
AUTH_KEY_NOT_FOUND: "auth key not found",
- EXIF_DATA_NOT_FOUND: "exif data not found",
- SELECT_FOLDER_ABORTED: "select folder aborted",
PROCESSING_FAILED: "processing failed",
EXPORT_RECORD_JSON_PARSING_FAILED: "export record json parsing failed",
TWO_FACTOR_ENABLED: "two factor enabled",