All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 1m14s
Der User pastet bewusst eine URL und erwartet, dass der Import klappt — die Whitelist-Prüfung (DOMAIN_BLOCKED) im previewRecipe war da nur Reibung. Die Whitelist bleibt für die Web-Suche relevant (dort muss das Crawl-Feld eingeschränkt werden), für Imports nicht mehr. Dropped: isDomainAllowed + whitelist.ts, DOMAIN_BLOCKED-Code in ImporterError, die zugehörige Branch in mapImporterError. Tests entsprechend angepasst: statt "DOMAIN_BLOCKED wenn nicht whitelisted" prüft der Preview-Test jetzt "klappt auch ohne Whitelist-Eintrag". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
16 lines
408 B
TypeScript
16 lines
408 B
TypeScript
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'
|
|
? 400
|
|
: e.code === 'NO_RECIPE_FOUND'
|
|
? 422
|
|
: 502; // FETCH_FAILED
|
|
error(status, { message: e.message, code: e.code });
|
|
}
|
|
throw e;
|
|
}
|