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

♻️ Extend PetrusError with type and originalError props #108

Merged
merged 1 commit into from
Aug 16, 2022

Conversation

cermakjiri
Copy link
Member

Usage example

import { configure, isPetrusError, PetrusErrorType } from '@ackee/petrus';


const sentryAcceptedErrors = new Set([PetrusErrorType.GET_AUTH_USER_FAILURE]);

configure({
   logger: {
      error(error) {

          if (isPetrusError(error) && sentryAcceptedErrors.has(error.type)) {
             // logout to Sentry
             console.error(error.message, error.type, error.originalError);
         }
       }
      // ...
   },
   // ...
})

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b479c11:

Sandbox Source
petrus-basic Configuration

@cermakjiri cermakjiri merged commit 1ef892f into master Aug 16, 2022
@cermakjiri cermakjiri deleted the feat/errors branch August 16, 2022 12:44
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.

1 participant