Skip to content

Commit

Permalink
fix: log sent error
Browse files Browse the repository at this point in the history
  • Loading branch information
cncolder committed Apr 1, 2018
1 parent 3d51163 commit 7d962bc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions microless/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,14 @@ export const sendError = (req: Request, res: Response, err: httpError.HttpError)
res.end({ error: err })
}

if (!DEV) return

if (err instanceof Error) {
console.error(err.stack)
if (DEV) {
console.error(err.stack)
} else {
console.error(err.message)
}
} else {
console.warn('thrown error must be an instance Error')
console.warn('thrown error should be an Error but got', err)
}
}

Expand Down

0 comments on commit 7d962bc

Please sign in to comment.