Created
July 3, 2017 21:03
-
-
Save UberMouse/9cfc54736efbc809cf0a086f7f64b780 to your computer and use it in GitHub Desktop.
Simple Redux middleware for logging exceptions to Raygun
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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