Skip to content

Commit

Permalink
feat: support sending status codes using errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosantangelo committed Sep 13, 2019
1 parent 3eaa444 commit 37e7919
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ export function handleRequest(
} catch (error) {
const data = error.data || {}
const message = error.message
const statusCode = error.statusCode

if (rollbar) rollbar.error(error, req)

if (statusCode) {
res.status(statusCode)
}

return res.json(sendError(data, message))
}
}
Expand Down

0 comments on commit 37e7919

Please sign in to comment.