Always add error info to Sentry logging

This commit is contained in:
Vesa Luusua 2018-03-16 12:04:17 +02:00
parent def1b3d6a7
commit 0ed1d879a5
3 changed files with 5 additions and 11 deletions

View file

@ -1,6 +1,6 @@
import { pick } from 'lodash';
import { denormalisedResponseEntities } from '../../util/data';
import { storableError, responseApiErrorInfo } from '../../util/errors';
import { storableError } from '../../util/errors';
import { TRANSITION_REQUEST } from '../../util/types';
import * as log from '../../util/log';
import { fetchCurrentUserHasOrdersSuccess } from '../../ducks/user.duck';
@ -138,7 +138,6 @@ export const initiateOrder = (orderParams, initialMessage) => (dispatch, getStat
listingId: orderParams.listingId.uuid,
bookingStart: orderParams.bookingStart,
bookingEnd: orderParams.bookingEnd,
apiErrorInfo: responseApiErrorInfo(e),
});
throw e;
});
@ -185,7 +184,6 @@ export const speculateTransaction = params => (dispatch, getState, sdk) => {
listingId: listingId.uuid,
bookingStart,
bookingEnd,
apiErrorInfo: responseApiErrorInfo(e),
});
return dispatch(speculateTransactionError(storableError(e)));
});

View file

@ -1,10 +1,6 @@
import { pick } from 'lodash';
import { types as sdkTypes } from '../../util/sdkLoader';
import {
isTransactionsTransitionInvalidTransition,
storableError,
responseApiErrorInfo,
} from '../../util/errors';
import { isTransactionsTransitionInvalidTransition, storableError } from '../../util/errors';
import {
TRANSITION_ACCEPT,
TRANSITION_DECLINE,
@ -275,7 +271,6 @@ export const acceptSale = id => (dispatch, getState, sdk) => {
log.error(e, 'accept-sale-failed', {
txId: id,
transition: TRANSITION_ACCEPT,
apiErrorInfo: responseApiErrorInfo(e),
});
throw e;
});
@ -300,7 +295,6 @@ export const declineSale = id => (dispatch, getState, sdk) => {
log.error(e, 'reject-sale-failed', {
txId: id,
transition: TRANSITION_DECLINE,
apiErrorInfo: responseApiErrorInfo(e),
});
throw e;
});

View file

@ -8,6 +8,7 @@
import Raven from 'raven-js';
import config from '../config';
import { responseApiErrorInfo } from './errors';
/**
* Set up error handling. If a Sentry DSN is
@ -53,7 +54,8 @@ export const clearUserId = () => {
*/
export const error = (e, code, data) => {
if (Raven.isSetup()) {
Raven.captureException(e, { tags: { code }, extra: data });
const extra = { ...data, apiErrorData: responseApiErrorInfo(e) };
Raven.captureException(e, { tags: { code }, extra });
} else {
console.error(e); // eslint-disable-line
console.error('Error code:', code, 'data:', data);