juspay / juspay/purescript-body-parser

Move response handling out of body-parser

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
0
Forks
3
PR merge metrics
No merged PRs in 30d

Description

As of now, both the `xml` and `multipart` parsers are setting response codes and serving requests in case of a parse error. We should ideally let the end-user handle these errors in their app. We can do this by calling `next` with a parse error.

e.g.
``` javascript
// ... inside parser function
try {
// try to parse
// add parsed data to request body
req.body = parsedReq
next()
} catch (e) {
// do either of the following
next(e)
// or
next(new Error(''))
}
// ...
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.