Inline
This commit is contained in:
parent
6f6ade1901
commit
81c729a405
2 changed files with 4 additions and 7 deletions
|
@ -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],
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Add table
Reference in a new issue