chore(web): prettier (#2821)

Co-authored-by: Thomas Way <thomas@6f.io>
This commit is contained in:
Jason Rasmussen 2023-07-01 00:50:47 -04:00 committed by GitHub
parent 7c2f7d6c51
commit f55b3add80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
242 changed files with 12794 additions and 13426 deletions

View file

@ -1,29 +1,26 @@
import type { ApiError } from '@api';
import {
notificationController,
NotificationType
} from '../components/shared-components/notification/notification';
import { notificationController, NotificationType } from '../components/shared-components/notification/notification';
export async function handleError(error: unknown, message: string) {
console.error(`[handleError]: ${message}`, error);
console.error(`[handleError]: ${message}`, error);
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 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)`;
}
let serverMessage = data?.message;
if (serverMessage) {
serverMessage = `${String(serverMessage).slice(0, 75)}\n(Immich Server Error)`;
}
notificationController.show({
message: serverMessage || message,
type: NotificationType.Error
});
notificationController.show({
message: serverMessage || message,
type: NotificationType.Error,
});
}