Skip to content

Commit

Permalink
Fixed error codes and removed redundant try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Lama64 committed Jul 14, 2024
1 parent ef9772a commit e9e1302
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions web/src/routes/admin/(resources)/students/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
try {
await createStudent(studentRequestDto);
} catch {
error(404, { message: 'Could not create student' });
error(400, { message: 'Could not create student' });
}
}
Expand All @@ -37,7 +37,7 @@
try {
await updateStudent(student.id, studentRequestDto);
} catch {
error(404, { message: 'Could not update student' });
error(400, { message: 'Could not update student' });
}
}
Expand Down Expand Up @@ -73,11 +73,7 @@
<div class="max-w-sm mt-5"></div>
<Button
on:click={async () => {
try {
data.create ? await create() : await update();
} catch {
error(404, { message: 'Could not update student' });
}
data.create ? await create() : await update();
}}
class="max-w-52 px-10 mt-5 bg-accent text-white"
variant="secondary">Speichern</Button
Expand Down

0 comments on commit e9e1302

Please sign in to comment.