Skip to content

Instantly share code, notes, and snippets.

@UberMouse
Created July 3, 2017 21:03
Show Gist options
  • Save UberMouse/9cfc54736efbc809cf0a086f7f64b780 to your computer and use it in GitHub Desktop.
Save UberMouse/9cfc54736efbc809cf0a086f7f64b780 to your computer and use it in GitHub Desktop.
Simple Redux middleware for logging exceptions to Raygun
const errorReportingMiddleware = store => next => action => {
try {
return next(action);
} catch(err) {
console.error('Caught an exception!', err);
rg4js('send', {
error: err,
customData: {
action,
state: store.getState()
}
});
}
};
export default errorReportingMiddleware;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment