added a check for errors without payloads

This commit is contained in:
Nikhil Nandagopal 2020-12-09 12:32:27 +05:30
parent e0ac6e9850
commit 0fc5817caa

View File

@ -87,7 +87,7 @@ export function* errorSaga(
// Just a pass through for now. // Just a pass through for now.
// Add procedures to customize errors here // Add procedures to customize errors here
log.debug(`Error in action ${errorAction.type}`); log.debug(`Error in action ${errorAction.type}`);
log.error(errorAction.payload.error); if (errorAction.payload) log.error(errorAction.payload.error);
// Show a toast when the error occurs // Show a toast when the error occurs
const { const {
type, type,
@ -105,7 +105,7 @@ export function* errorSaga(
yield put({ yield put({
type: ReduxActionTypes.REPORT_ERROR, type: ReduxActionTypes.REPORT_ERROR,
payload: { payload: {
message: errorAction.payload.error, message: errorAction.payload ? errorAction.payload.error : undefined,
source: errorAction.type, source: errorAction.type,
}, },
}); });