npm install @airbrake/browser redux-airbrake --save
import { Notifier } from '@airbrake/browser';
import airbrakeMiddleware from 'redux-airbrake';
const airbrake = new Notifier({
projectId: '******',
projectKey: '**************'
});
const errorMiddleware = airbrakeMiddleware(airbrake);
export const store = createStore(
rootReducer,
applyMiddleware(
errorMiddleware
)
);
export default store;
It's possible to annotate error notices with all sorts of useful information at the time they're captured by supplying it in the object being reported.
const errorMiddleware = airbrakeMiddleware(airbrake, {
noticeAnnotations: { context: { environment: window.ENV } }
});
Since an Airbrake instrace is passed to the middleware, you can simply add filters to the instance as described here:
https://github.com/airbrake/airbrake-js/tree/master/packages/browser#filtering-errors
For full documentation, visit redux-airbrake on GitHub.