Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom error handlers in httpRaw() #20

Closed
Tracked by #15
insyri opened this issue Dec 3, 2022 · 2 comments
Closed
Tracked by #15

Custom error handlers in httpRaw() #20

insyri opened this issue Dec 3, 2022 · 2 comments
Assignees

Comments

@insyri
Copy link
Owner

insyri commented Dec 3, 2022

Some endpoints have different implications to each kind of HTTP response code, for example, not all 500s are internal server errors, they could be authentication mismatching in specific context.

Array<{
  // Determines if case is applicable; number for HTTP status code, or
  // a function that takes the response object and returns the validity.
  case: number | (r: Response) => boolean,
  // Function to run if `case` matches the response's HTTP status code
  // or is true.
  fn: () => void,
}>

Proposals

  • Add parameter that specifies an array of cases and functions.
@insyri insyri mentioned this issue Dec 3, 2022
12 tasks
@insyri
Copy link
Owner Author

insyri commented Dec 3, 2022

lol

@insyri insyri changed the title Custom error handlers in httpRaw()Some endpoints have different implications to each kind of HTTP response code, for example, not all 500s are internal server errors, they could be authentication mismatching in specific context. (Idea: add parameter that specifies an array of cases and functions.)Array<{ // Determines if case is applicable; number for HTTP status code, or // a function that takes the response object and returns the validity. case: number | (r: Response) => boolean, // Function to run if case matches the response's HTTP status code // or is true. fn: () => void,}> boolean, // Function to run if case matches the response's HTTP status code // or is true. fn: () => void,}>" tabindex="0" role="button"> Custom error handler Dec 3, 2022
@insyri insyri changed the title Custom error handler Custom error handlers in httpRaw() Dec 3, 2022
@insyri insyri self-assigned this Dec 3, 2022
insyri added a commit that referenced this issue Dec 3, 2022
insyri added a commit that referenced this issue Dec 10, 2022
@insyri
Copy link
Owner Author

insyri commented Dec 11, 2022

Looks like this last commit implements this feature

@insyri insyri closed this as completed Dec 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant