refactor(server): download assets (#3032)

* refactor: download assets

* chore: open api

* chore: finish tests, make size configurable

* chore: defualt to 4GiB

* chore: open api

* fix: optional archive size

* fix: bugs

* chore: cleanup
This commit is contained in:
Jason Rasmussen 2023-06-30 12:24:28 -04:00 committed by GitHub
parent df9c05bef3
commit ad343b7b32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 1455 additions and 1403 deletions

View file

@ -4,10 +4,20 @@ import {
NotificationType
} from '../components/shared-components/notification/notification';
export function handleError(error: unknown, message: string) {
export async function handleError(error: unknown, message: string) {
console.error(`[handleError]: ${message}`, error);
let serverMessage = (error as ApiError)?.response?.data?.message;
let data = (error as ApiError)?.response?.data;
if (data instanceof Blob) {
const response = await data.text();
try {
data = JSON.parse(response);
} catch {
data = { message: response };
}
}
let serverMessage = data?.message;
if (serverMessage) {
serverMessage = `${String(serverMessage).slice(0, 75)}\n(Immich Server Error)`;
}