Files
musicseerr/frontend/src/lib/utils/errorHandling.ts
T
Arno 63ccf03dac refactor: Prototype of tanstack-query (#34)
* move getApiUrl to api folder

* adjust imports

* tanstack-query example with homeData

* small adjustments

* fix key collision

* new MusicSource persistent mechanism example

* add error handling & set sveltekit to SPA mode

* remove unnecessary ssr test
2026-04-11 13:46:07 +01:00

17 lines
582 B
TypeScript

import { isValidMbid } from '$lib/utils/formatting';
import { getApiUrl } from '$lib/api/api-utils';
export function isAbortError(error: unknown): boolean {
return (
(error instanceof DOMException && error.name === 'AbortError') ||
(error instanceof Error && error.name === 'AbortError')
);
}
export function getCoverUrl(coverUrl: string | null | undefined, albumId: string): string {
if (isValidMbid(albumId)) {
return getApiUrl(`/api/v1/covers/release-group/${albumId}?size=250`);
}
return coverUrl || getApiUrl(`/api/v1/covers/release-group/${albumId}?size=250`);
}