Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A way to describe response error while conforming to Flux Standard Action and passing request info
* see redux-actions lib to see how `createAction` works
import { createAction } from 'redux-act(ions)';
class ResponseError extends Error { /* add a `this.request` prop */ }
/** add a `meta` field when payload in an Error */
const receiveEntity = createAction('SOME_TYPE', identity, payload => {
if (payload instanceof ResponseError) {
return { request: payload.request };
return undefined;
dispatch(receiveEntity(new ResponseError({ id: 123 })))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment