Skip to content

Commit 8580d5b

Browse files
mariayordschwma
andauthored
Update lib/logger.js
Co-authored-by: Marcel Schwarz <[email protected]>
1 parent d6af0cc commit 8580d5b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/logger.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ InvalidJSON.prototype.status = 400
1414

1515
router.use(function jsonBodyParser(req, res, next) {
1616
express.json({ ...cds.env.server.body_parser }) (req, res, function http_body_parser_next(err) {
17-
if (err) { // Need to wrap, as a rethrow would crash the server
18-
let e = new InvalidJSON(err.message)
19-
return next(e)
20-
}
17+
// Need to wrap, as CAP server deliberately crashes on SyntaxErrors
18+
if (err) return next(new InvalidJSON(err.message)
2119
next()
2220
})
2321
})

0 commit comments

Comments
 (0)