Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

allow for custom error handling #92

Open
2 tasks done
jcbain opened this issue Aug 7, 2023 · 0 comments
Open
2 tasks done

allow for custom error handling #92

jcbain opened this issue Aug 7, 2023 · 0 comments

Comments

@jcbain
Copy link
Contributor

jcbain commented Aug 7, 2023

Prerequisites

  • I have written a descriptive issue title
  • 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 })
jcbain added a commit to TugboatQA/fast-proxy that referenced this issue Aug 8, 2023
jcbain added a commit to TugboatQA/fast-proxy that referenced this issue Aug 8, 2023
jcbain added a commit to TugboatQA/fast-proxy that referenced this issue Aug 8, 2023
jcbain added a commit to TugboatQA/fast-proxy that referenced this issue Aug 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant