Skip to content

Commit

Permalink
Output server errors in JSON { message: ... }
Browse files Browse the repository at this point in the history
Output server errors in JSON { message: ... }
  • Loading branch information
sashachabin committed Jul 27, 2022
1 parent 58e4849 commit 6eccd73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/index.js
Expand Up @@ -25,12 +25,12 @@ http
res.end()
} catch (error) {
res.writeHead(400, defaultHeaders)
res.write(JSON.stringify({ error }))
res.write(JSON.stringify({ message: error.message }))
res.end()
}
} else {
res.writeHead(404, defaultHeaders)
res.write(JSON.stringify({ error: 'Not found' }))
res.write(JSON.stringify({ message: 'Not found' }))
res.end()
}
})
Expand Down

0 comments on commit 6eccd73

Please sign in to comment.