fix: validation error handling (resolves #3)
Commit / ci (push) Successful in 10m34s
PullRequest / publish (pull_request) Failing after 2m36s

This commit is contained in:
2026-04-03 13:00:14 +02:00
parent 2e16cf9d51
commit 7492680457
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import { db } from '$lib/server/db';
import { aktis, ratings } from '$lib/server/db/schema';
import { error, redirect, type Actions } from '@sveltejs/kit';
import { error, fail, redirect, type Actions } from '@sveltejs/kit';
import { and, eq } from 'drizzle-orm';
import type { PageServerLoad } from './$types';
import { ensureAuth } from '$lib/auth';
@@ -54,7 +54,7 @@ export const actions = {
)
).data;
if (!changeRequest) return error(400);
if (!changeRequest) return fail(400, { message: 'Invalid data' });
await db
.update(aktis)
@@ -1,6 +1,6 @@
import type { PageServerLoad } from './$types';
import { ensureAuth } from '$lib/auth';
import { error, redirect, type Actions } from '@sveltejs/kit';
import { error, fail, redirect, type Actions } from '@sveltejs/kit';
import { extractFormData } from '$lib/extractFormData';
import { aktis, ratings } from '$lib/server/db/schema';
import { eq } from 'drizzle-orm';
@@ -54,7 +54,7 @@ export const actions = {
)
).data;
if (!rating) return error(400);
if (!rating) return fail(400, { message: 'Invalid data' });
await db.insert(ratings).values({
...rating,