Skip to content

Conversation

Grafikart
Copy link
Contributor

@Grafikart Grafikart commented Nov 24, 2020

On a project i'm working on I have interceptors that can throw custom errors. Internally use-http rewrite error and every detail about the cause of the error is lost).

Here is an example of use case

  const useHttpOptions = {
    interceptors: {
      response: async ({ response }) => {
        if (!hasErrorCode(response)) {
          return response
        }
        throw new ApiError({
          errorCode: response.data.error,
          // Some other informations
        })
      },
    },
  }

I didn't get the intention behind the makeError() call in the catch clause.

@iamthesiz iamthesiz merged commit e7f85bc into ava:master Nov 25, 2020
@iamthesiz
Copy link
Collaborator

lgtm

@iamthesiz
Copy link
Collaborator

available in v1.0.16

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

Successfully merging this pull request may close these issues.

2 participants