Skip to content

Commit

Permalink
Output server errors in JSON { message: ... }
Browse files Browse the repository at this point in the history
  • Loading branch information
sashachabin committed Jul 27, 2022
1 parent 88cd470 commit 5406b57
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(error.message)
res.write({ message: error.message })
res.end()
}
} else {
res.writeHead(404, defaultHeaders)
res.write('Not found')
res.write({ message: 'Not found' })
res.end()
}
})
Expand Down

0 comments on commit 5406b57

Please sign in to comment.