Registry / observability / redux-catch

redux-catch

JSON →
library1.3.1jsnpmunverified

Error catcher middleware for Redux that intercepts errors thrown in reducers and synchronous middlewares. Version 1.3.1 is the latest stable release, with infrequent updates. It allows you to provide a custom error handler function that receives the error, current state via getState, the last dispatched action, and a dispatch function. Unlike Redux's built-in error handling, redux-catch supports logging, reporting to services like Sentry, and optionally dispatching actions on errors. It should be placed as the first middleware in the chain. Comes as ES module (no Babel build, uses arrow functions).

npm install redux-catch
INSTALL
IMPORT
SIG · REDUX-CATCH
R
redux-catch
observabilityjavascriptv1.3.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (reduxCatch)
import reduxCatch from 'redux-catch';
const reduxCatch = require('redux-catch');
Package is ESM-only; commonJS require may fail in some bundlers.

Creates a Redux store with the redux-catch middleware to catch errors from reducers and sync middlewares, logging them and optionally dispatching actions.

import { createStore, applyMiddleware } from 'redux'; import reduxCatch from 'redux-catch'; import reducer from './reducer'; function errorHandler(error, getState, lastAction, dispatch) { console.error('Error caught by middleware:', error); console.debug('Current state:', getState()); console.debug('Last action:', lastAction); // Optionally dispatch an error action: dispatch({ type: 'ERROR', payload: error }); } const store = createStore( reducer, applyMiddleware(reduxCatch(errorHandler)) ); // Usage: dispatching an action that causes an error in reducer will trigger errorHandler store.dispatch({ type: 'INVALID_ACTION' });
Debug
Known issues
gotcharedux-catch only catches errors from reducers and synchronous middlewares, not from asynchronous middlewares or dispatched action creators.
fix
Use a different error handling pattern for async middleware (e.g., wrap your async thunks in try-catch).
affects: >=1.0.0
gotchaThe middleware must be placed as the first middleware in the chain to catch errors from all subsequent middleware.
fix
Ensure reduxCatch is the first argument to applyMiddleware, or positioned before other middleware.
affects: >=1.0.0
Errors
Common errors & fixes
Uncaught TypeError: Cannot destructure property 'getState' of '...' as it is undefined.
Using the error handler signature incorrectly; the getState parameter is the second argument, but may be destructured wrong if using older version.
fix
Use function(error, getState, lastAction, dispatch) { ... } for v1.3.0+.
Uncaught ReferenceError: regeneratorRuntime is not defined
The package uses async generators or ES6 features without proper transpiler setup.
fix
Ensure your build system supports ES6 features; redux-catch uses arrow functions. Add babel-polyfill if needed for older environments.
Upgrade
Version history
1.3.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
2
Resources
redux-catch — npm install redux-catch · libregistry