feat(api): expose preview/import/profile/domain endpoints

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-17 15:12:59 +02:00
parent 5693371673
commit 86ff4c141a
8 changed files with 161 additions and 1 deletions

17
src/lib/server/errors.ts Normal file
View File

@@ -0,0 +1,17 @@
import { error } from '@sveltejs/kit';
import { ImporterError } from './recipes/importer';
export function mapImporterError(e: unknown): never {
if (e instanceof ImporterError) {
const status =
e.code === 'INVALID_URL' || e.code === 'DOMAIN_BLOCKED'
? e.code === 'DOMAIN_BLOCKED'
? 403
: 400
: e.code === 'NO_RECIPE_FOUND'
? 422
: 502; // FETCH_FAILED
error(status, { message: e.message, code: e.code });
}
throw e;
}