Fix Action Validation Error Handling #3
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Where:
src/routes/akti/[aktiId]/+page.server.tsandsrc/routes/akti/[aktiId]/comment/+page.server.tsWhy: Currently returning
error(400)on validation failure, which wipes form data and shows a generic error page.Fix: Use SvelteKit's
fail(400, { message: 'Invalid data' })to keep the user on the page and preserve their input.