Skip to content

Reducer errors swallowed silently after epics' outputs #263

@haf

Description

@haf
const reducer = (state = {}, action) => {
  switch (action.type) {
    case 'THING':
      return { ...state, thing: action.nonexistent.childprop }
    default:
      return state;
  }
};
export function sampleEpic(action$: Observable, store: Store) {
  return action$.ofType(ANYTHING)
    .concatMap(action =>
      fetch('/api/anything', { ... })
    .mergeMap(response => {
      switch (response.status) {
        case 409:
          return Observable.of(pleaseNo(email));
        case 201:
          return Observable.of({ type: 'THING' }, { type: 'NEVER_DISPATCHED' });
        default:
          throw new Error(`Unknown response code ${response.code}`);
      }
    });
}

The THING action causes a crash that is hidden from the user (me for the last 2 hours) so that it's very hard to see where things went wrong.

Adding catch to the end of the epic doesn't make a difference.

All middleware a successfully run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions