Skip to content
Snippets Groups Projects
Commit 70224214 authored by William Faircloth's avatar William Faircloth
Browse files

use throw instead of return

parent 410120aa
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ export const actions = {
ask: async (event) => {
try {
const formData = await event.request.formData();
if (!formData.has('question')) return error(400, 'No question provided');
if (!formData.has('question')) throw error(400, 'No question provided');
const question = formData.get('question')?.toString() || 'Something went wrong!';
console.log("Recieved question: " + question);
const useContext = formData.get('useContext')?.toString() === 'on' || false;
......@@ -38,7 +38,7 @@ export const actions = {
return { context, loading: false };
} catch (e) {
console.error(e);
return error(500, e.message);
throw error(500, e.message);
}
}
} satisfies Actions;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment