(error)
| 43 | |
| 44 | export default class Errors { |
| 45 | static handle(error) { |
| 46 | const { captureException } = useLogRocket(); |
| 47 | |
| 48 | captureException(error); |
| 49 | |
| 50 | if (import.meta.env.NODE_ENV !== 'test') { |
| 51 | console.error(selectErrorMessage(error)); |
| 52 | console.error(error); |
| 53 | } |
| 54 | |
| 55 | if (selectErrorCode(error) === 401) { |
| 56 | AuthService.signout(); |
| 57 | window.location.reload(); |
| 58 | return; |
| 59 | } |
| 60 | |
| 61 | if (selectErrorCode(error) === 403) { |
| 62 | if (error.config.url.includes('member/export')) { |
| 63 | // we'll be handling these differently |
| 64 | return; |
| 65 | } |
| 66 | |
| 67 | if ( |
| 68 | error.response.data.includes('Missing scopes in ') |
| 69 | ) { |
| 70 | Message.error(error.response.data, { duration: 0 }); |
| 71 | return; |
| 72 | } |
| 73 | router.push('/403'); |
| 74 | return; |
| 75 | } |
| 76 | |
| 77 | if ([400, 409, 429].includes(selectErrorCode(error))) { |
| 78 | Message.error(selectErrorMessage(error)); |
| 79 | return; |
| 80 | } |
| 81 | |
| 82 | if (selectErrorCode(error) === 542) { |
| 83 | Message.error( |
| 84 | 'An error has occurred setting up the integration, please reach out to us via chat, or via email (help@crowd.dev)', |
| 85 | { duration: 0 }, |
| 86 | ); |
| 87 | return; |
| 88 | } |
| 89 | |
| 90 | Message.error( |
| 91 | 'Please try again. If the problem remains, reach out to us.', |
| 92 | { title: 'Oops, something went wrong' }, |
| 93 | ); |
| 94 | } |
| 95 | |
| 96 | static errorCode(error) { |
| 97 | return selectErrorCode(error); |
no test coverage detected