Skip to content

Commit

Permalink
Better errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kognise committed Mar 21, 2023
1 parent d99fdad commit 7ce8eea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pages/migration-redirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ export const post: APIRoute = async ({ request }) => {
let redirect
try {
const body = await request.formData()
puzzleLab = body.get('puzzleLab')
if (typeof puzzleLab !== 'string') throw 'Invalid form data'
puzzleLab = body.get('puzzle-lab')
if (typeof puzzleLab !== 'string') throw 'Invalid puzzle lab'
redirect = body.get('redirect')
if (typeof redirect !== 'string' && redirect !== null) throw 'Invalid form data'
if (typeof redirect !== 'string' && redirect !== null) throw 'Invalid redirect'
} catch (error) {
return new Response(typeof error === 'string' ? error : 'Bad request body', { status: 400 })
}
Expand Down

0 comments on commit 7ce8eea

Please sign in to comment.