From 16e14235c92848820230e4008ab63c4e5541cd2d Mon Sep 17 00:00:00 2001 From: Gautham Krishna Date: Thu, 26 Oct 2023 17:13:14 +0530 Subject: [PATCH] checking error when post is fetched --- src/routes/post/[slug]/+page.server.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/routes/post/[slug]/+page.server.ts b/src/routes/post/[slug]/+page.server.ts index 04e5b2d..61da253 100644 --- a/src/routes/post/[slug]/+page.server.ts +++ b/src/routes/post/[slug]/+page.server.ts @@ -10,14 +10,16 @@ export async function load({ params, locals }) { console.log(res); if (res.error) { // throwing error for user not found + console.log(res.error); throw error(400, 'Post Not Found'); } else { if (res.data) { + console.log(res.data); return res.data; } } } } //throwing error for invalid user id - throw error(400, 'Invalid User ID'); + throw error(400, 'Not Logged in '); }