diff --git a/web/apps/photos/src/services/upload/exifService.ts b/web/apps/photos/src/services/upload/exifService.ts index 42afb7618..acc6a0b08 100644 --- a/web/apps/photos/src/services/upload/exifService.ts +++ b/web/apps/photos/src/services/upload/exifService.ts @@ -1,5 +1,4 @@ import log from "@/next/log"; -import { CustomError } from "@ente/shared/error"; import { validateAndGetCreationUnixTimeInMicroSeconds } from "@ente/shared/time"; import { NULL_LOCATION } from "constants/upload"; import exifr from "exifr"; @@ -176,7 +175,7 @@ function parseExifData(exifData: RawEXIFData): ParsedEXIFData { function parseEXIFDate(dateTimeString: string) { try { if (typeof dateTimeString !== "string" || dateTimeString === "") { - throw Error(CustomError.NOT_A_DATE); + throw new Error("Invalid date string"); } // Check and parse date in the format YYYYMMDD @@ -207,7 +206,7 @@ function parseEXIFDate(dateTimeString: string) { typeof day === "undefined" || Number.isNaN(day) ) { - throw Error(CustomError.NOT_A_DATE); + throw new Error("Invalid date"); } let date: Date; if ( @@ -223,7 +222,7 @@ function parseEXIFDate(dateTimeString: string) { date = new Date(year, month - 1, day, hour, minute, second); } if (Number.isNaN(+date)) { - throw Error(CustomError.NOT_A_DATE); + throw new Error("Invalid date"); } return date; } catch (e) { @@ -245,7 +244,7 @@ export function parseEXIFLocation( gpsLatitude.length !== 3 || gpsLongitude.length !== 3 ) { - throw Error(CustomError.NOT_A_LOCATION); + throw new Error("Invalid EXIF location"); } const latitude = convertDMSToDD( gpsLatitude[0], diff --git a/web/packages/shared/error/index.ts b/web/packages/shared/error/index.ts index cf01a3843..736520b49 100644 --- a/web/packages/shared/error/index.ts +++ b/web/packages/shared/error/index.ts @@ -48,8 +48,6 @@ export const CustomError = { SUBSCRIPTION_NEEDED: "subscription not present", NOT_FOUND: "not found ", NO_METADATA: "no metadata", - NOT_A_DATE: "not a date", - NOT_A_LOCATION: "not a location", FILE_ID_NOT_FOUND: "file with id not found", WEAK_DEVICE: "password decryption failed on the device", INCORRECT_PASSWORD: "incorrect password",