aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/invoice/+server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/(app)/invoice/+server.ts')
-rw-r--r--src/routes/(app)/invoice/+server.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/routes/(app)/invoice/+server.ts b/src/routes/(app)/invoice/+server.ts
index f20d70f3..f494c153 100644
--- a/src/routes/(app)/invoice/+server.ts
+++ b/src/routes/(app)/invoice/+server.ts
@@ -1,7 +1,12 @@
import { auth, post } from "$lib/utils";
-import { json } from "@sveltejs/kit";
+import { error, json } from "@sveltejs/kit";
export const POST = async ({ cookies, request }) => {
- const body = await request.json();
- return json(await post("/invoice", body, auth(cookies)));
+ try {
+ const body = await request.json();
+ return json(await post("/invoice", body, auth(cookies)));
+ } catch (e) {
+ const { message } = e as Error;
+ error(500, message);
+ }
};