Skip to content

Commit

Permalink
feat(error-handling): capture saga errors with Sentry if enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
lutangar committed Jul 2, 2019
1 parent cadc9c4 commit e96465d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/app/sagas/error.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { takeLatest } from 'redux-saga/effects';
import { SagaIterator } from 'redux-saga';
import { captureException } from '@sentry/browser';
import { BaseAction, ErrorAction } from '../actions';

export function* handleErrorSaga({
payload: e
}: ErrorAction): IterableIterator<any> {
console.error(e);
}: ErrorAction): SagaIterator {
if (process.env.SENTRY_ENABLE) {
captureException(e);
} else {
console.error(e);
}
}

export default function* errorRootSaga() {
Expand Down

0 comments on commit e96465d

Please sign in to comment.