/** * Formats log input so we can send it to sentry. */ function sentryFormatter(opts, severity, date, elems) { const messageParts = []; let skip = 0; let error; for (const elem of elems) { // Sentry does not allow passing a message to captureException, // so we need to decide here if it's going to be treated // as such or not. if (isError(elem)) { error = elem; } else if (isFormattable(elem)) { messageParts.push(elem); } else { break; } skip++; } const message = messageParts.join(' '); return { message: message, error: error, extra: elems.slice(skip) }; }
return next => action => { if (typeof action === 'function') { return action(dispatch, getState); } const {error, ...rest} = action; if (error && isError(error)) { const errorMessage = error.message; next({...rest, error: errorMessage}); } return next(action); };
return (...args) => { const action = { type } const payload = getPayload(...args) if (!isUndefined(payload)) action.payload = payload // Handle FSA errors where the payload is an Error object or has error prop. Set error. if (args.length && (isError(args[0]) || (args[0] && args[0].error))) { action.error = true } const meta = getMeta(...args) if (meta) { action.meta = meta } return action }