MM-11018 Provide default message for Sentry breadcrumbs (#1819)

This commit is contained in:
Harrison Healey 2018-06-25 11:25:31 -04:00 committed by Elias Nahum
parent a9508d30f9
commit 599fa7b4e1

View file

@ -19,23 +19,22 @@ export function createSentryMiddleware() {
}
function makeBreadcrumbFromAction(action) {
if (!action.type) {
console.warn('dispatching action with undefined type', action); // eslint-disable-line no-console
}
const breadcrumb = {
category: BREADCRUMB_REDUX_ACTION,
message: action.type,
message: action.type || 'undefined action',
};
if (action.type === BATCH) {
// Attach additional information so that batched actions display what they're doing
breadcrumb.data = action.payload.map((a) => a.type);
}
if (action.type === BATCH) {
// Attach additional information so that batched actions display what they're doing, and make it
// into an object because that's what is expected
breadcrumb.data = {};
action.payload.forEach((a, index) => {
breadcrumb.data[index] = a.type;
breadcrumb.data[index] = a.type || 'undefined action';
});
}