From 599fa7b4e17a03a1727fa8f9617055b6d206ad96 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 25 Jun 2018 11:25:31 -0400 Subject: [PATCH] MM-11018 Provide default message for Sentry breadcrumbs (#1819) --- app/utils/sentry/middleware.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/utils/sentry/middleware.js b/app/utils/sentry/middleware.js index 8822dfb81..434fadba6 100644 --- a/app/utils/sentry/middleware.js +++ b/app/utils/sentry/middleware.js @@ -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'; }); }