This commit is contained in:
Manav Rathi
2024-07-06 14:02:32 +05:30
parent 53a8de9ac4
commit 8fc897ad16
2 changed files with 4 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ import {
getLocalTrashedFiles,
} from "@/new/photos/services/files";
import type { EnteFile } from "@/new/photos/types/file";
import { authenticatedRequestHeaders, ensure2xx } from "@/next/http";
import { authenticatedRequestHeaders, ensureOk } from "@/next/http";
import { getKV, setKV } from "@/next/kv";
import log from "@/next/log";
import { apiURL } from "@/next/origins";
@@ -243,7 +243,7 @@ const getEmbeddingsDiff = async (
const res = await fetch(`${url}?${params.toString()}`, {
headers: await authenticatedRequestHeaders(),
});
ensure2xx(res);
ensureOk(res);
return z.object({ diff: z.array(RemoteEmbedding) }).parse(await res.json())
.diff;
};
@@ -281,7 +281,7 @@ export const putEmbedding = async (
model,
}),
});
ensure2xx(res);
ensureOk(res);
};
// MARK: - Face

View File

@@ -46,7 +46,7 @@ export class HTTPError extends Error {
* A convenience method that throws an {@link HTTPError} if the given
* {@link Response} does not have a HTTP 2xx status.
*/
export const ensure2xx = (res: Response) => {
export const ensureOk = (res: Response) => {
if (!res.ok) throw new HTTPError(res);
};