What is the right way to throw errors from an API handler in next 13
Unanswered
Barbary Lion posted this in #help-forum
Barbary LionOP
Is this the right way to do it?
export async function GET(request: Request) {
try {
// some function
} catch (e) {
console.error(e);
return new Response(JSON.stringify(e), { status: 500 });
}
}