npm install airbrake-js redux-airbrake --save
import AirbrakeClient from 'airbrake-js';
import airbrakeMiddleware from 'redux-airbrake';
const airbrake = new AirbrakeClient({
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#filtering-errors
For full documentation, visit redux-airbrake on GitHub.