Steamline errors

This commit is contained in:
Luca Bosin
2023-08-28 08:42:24 +02:00
parent 382e682487
commit 15a93fbba7
3 changed files with 35 additions and 3 deletions

View File

@ -0,0 +1,13 @@
import { error } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
import { getZipName } from '$lib/util/links';
import { getMetadata } from '$lib/util/album';
export const load: PageServerLoad = async ({ params }) => {
try {
await getMetadata(getZipName(params));
} catch (e) {
throw error(404, 'Album not found');
}
throw error(400, 'No item specified');
};