fast-proxy
fast-proxy copied to clipboard
allow for custom error handling
Prerequisites
- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
Currently, if an error is thrown when the proxied request is made, the error is handled by fast-proxy
. It would be nice for an optional callback to be passed so that the error, req, and res can be exposed to the user and handled as they see fit.
Motivation
No response
Example
function handleErrors (err, req, res) {
If(res.writableFinished === false) {
if(err.code === 'SOMETHING') {
// some logic here
}
}
}
proxy(req, res, source, { onError: handleErrors })