Skip to content

Commit

Permalink
Add status fallback to error handling (#164)
Browse files Browse the repository at this point in the history
Add `status` fallback to error handling.
This change make some useful libraries(http-assert) compatible with `micro`
  • Loading branch information
dotcypress authored and leo committed Mar 6, 2017
1 parent eaa1d42 commit 9b33adb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ function send(res, code, obj = null) {
res.end(str)
}

function sendError(req, res, {statusCode, message, stack}) {
function sendError(req, res, {statusCode, status, message, stack}) {
if (statusCode) {
send(res, statusCode, DEV ? stack : message)
send(res, statusCode || status, DEV ? stack : message)
} else {
send(res, 500, DEV ? stack : 'Internal Server Error')
}
Expand Down

0 comments on commit 9b33adb

Please sign in to comment.