All Projects → PlatziDev → Redux Catch

PlatziDev / Redux Catch

Licence: mit
Error catcher middleware for Redux reducers and sync middlewares

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Redux Catch

Sentry Cocoa
The official Sentry SDK for iOS, tvOS, macOS, watchOS
Stars: ✭ 370 (+146.67%)
Mutual labels:  sentry, error-handler
ReSwiftMonitor
ReSwift+redeux dev tools
Stars: ✭ 13 (-91.33%)
Mutual labels:  middleware, redux-middleware
Redux Firebase Middleware
🔌 🔥 Redux firebase middleware for React and React-native
Stars: ✭ 17 (-88.67%)
Mutual labels:  middleware, redux-middleware
Raven For Redux
A Raven middleware for Redux
Stars: ✭ 300 (+100%)
Mutual labels:  redux-middleware, sentry
Sentry Php
The official PHP SDK for Sentry (sentry.io)
Stars: ✭ 1,591 (+960.67%)
Mutual labels:  sentry, error-handler
Foxify
The fast, easy to use & typescript ready web framework for Node.js
Stars: ✭ 138 (-8%)
Mutual labels:  middleware
Hwamei
企业微信webhook,企业微信群机器人webhook,支持Github、Gitlab、Sentry等Webhook
Stars: ✭ 142 (-5.33%)
Mutual labels:  sentry
Raven Python
Raven is the legacy Python client for Sentry (getsentry.com) — replaced by sentry-python
Stars: ✭ 1,677 (+1018%)
Mutual labels:  sentry
Advanced Http4s
🌈 Code samples of advanced features of Http4s in combination with some features of Fs2 not often seen.
Stars: ✭ 136 (-9.33%)
Mutual labels:  middleware
Request Migrations
HTTP Request Migrations for API Versioning like Stripe
Stars: ✭ 149 (-0.67%)
Mutual labels:  middleware
Redux Persist
persist and rehydrate a redux store
Stars: ✭ 11,738 (+7725.33%)
Mutual labels:  redux-middleware
Bricks
A standard library for microservices.
Stars: ✭ 142 (-5.33%)
Mutual labels:  sentry
Owaspheaders.core
A .NET Core middleware for injecting the Owasp recommended HTTP Headers for increased security
Stars: ✭ 138 (-8%)
Mutual labels:  middleware
Raven Weapp
Sentry SDK for WeApp
Stars: ✭ 142 (-5.33%)
Mutual labels:  sentry
Redux Most
Most.js based middleware for Redux. Handle async actions with monadic streams & reactive programming.
Stars: ✭ 137 (-8.67%)
Mutual labels:  middleware
Serverless Sentry Plugin
This plugin adds automatic forwarding of errors and exceptions to Sentry (https://sentry.io) and Serverless (https://serverless.com)
Stars: ✭ 146 (-2.67%)
Mutual labels:  sentry
Quicklogger
Library for logging on files, console, memory, email, rest, eventlog, syslog, slack, telegram, redis, logstash, elasticsearch, influxdb, graylog, Sentry, Twilio, ide debug messages and throw events for Delphi/Firemonkey/freepascal/.NET (Windows/Linux/OSX/IOS/Android).
Stars: ✭ 137 (-8.67%)
Mutual labels:  sentry
Graphql Middleware Sentry
🗃 A GraphQL Middleware plugin for Sentry.
Stars: ✭ 141 (-6%)
Mutual labels:  sentry
Aspnetcoreratelimit
ASP.NET Core rate limiting middleware
Stars: ✭ 2,199 (+1366%)
Mutual labels:  middleware
Silicon
A high performance, middleware oriented C++14 http web framework please use matt-42/lithium instead
Stars: ✭ 1,721 (+1047.33%)
Mutual labels:  middleware

redux-catch

Error catcher middleware for Redux reducers and sync middlewares.

Build Status XO code style

API

Apply middleware

import { createStore, applyMiddleware } from 'redux';

import reduxCatch from 'redux-catch';

import reducer from './reducer';

function errorHandler(error, getState, lastAction, dispatch) {
  console.error(error);
  console.debug('current state', getState());
  console.debug('last action was', lastAction);
  // optionally dispatch an action due to the error using the dispatch parameter
}

const store = createStore(reducer, applyMiddleware(
  reduxCatch(errorHandler)
));
  • reduxCatch receive a function to use when an error happen.
  • The error handler function could be just a console.error like the example above or a function to log the error in some kind of error tracking platform.
  • You should use this middleware as the first middleware in the chain, so its allowed to catch all the possible errors in the application.

Using it with Sentry

To use it with Sentry just download the Sentry script from npm:

npm i -S raven-js raven
  • raven-js: This is the client for browser usage.
  • raven-node: This is the client for server usage.

Now load and configure your client:

import Raven from 'raven-js';

const sentryKey = '<key>';

Raven
  .config(`https://${sentryKey}@app.getsentry.com/<project>`)
  .install();

And then use Raven.captureException as the error handler like this:

const store = createStore(reducer, applyMiddleware(
  reduxCatch(error => Raven.captureException(error));
));

Now redux-catch will start to send the errors of your reducers and middlewares to Sentry.

Add state as extra data

You can also add the state data as extra data for your errors so you can know the state at the moment of the error.

function errorHandler(error, getState, action) {
  Raven.context({
    state: getState(),
    action,
  });
  Raven.captureException(error);
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].