You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New options parameter on report() for per-call config.
Add skipLocalFrames option to trim the head of a locally generated
stacktrace to remove more than one level.
Enforce valid jsdoc using eslint and add params for test helpers.
Add documentation for passing options to report().
// reportUncaughtExceptions: false // (optional) Set to false to stop reporting unhandled exceptions.
81
81
// reportUnhandledPromiseRejections: false // (optional) Set to false to stop reporting unhandled promise rejections.
82
-
// disabled: true // (optional) Set to true to not report errors when calling report(), this can be used when developping locally.
82
+
// disabled: true // (optional) Set to true to not report errors when calling report(), this can be used when developing locally.
83
83
// context: {user: 'user1'} // (optional) You can set the user later using setUser()
84
84
});
85
85
});
@@ -228,13 +228,28 @@ Consumption of the errorHandlerUtility would essentially follow the following pa
228
228
// MyComponent.jsx
229
229
importerrorHandlerfrom'./errorHandlerUtility';
230
230
231
-
// Some example code that throws an error
232
-
.catch(error) {
231
+
try {
232
+
someFunctionThatThrows();
233
+
} catch (error) {
233
234
errorHandler.report(error);
234
235
}
235
236
236
237
```
237
238
239
+
If the call to report has additional levels of wrapping code, extra
240
+
frames can be trimmed from the top of generated stacks by using a
241
+
number greater than one for the `skipLocalFrames` option:
242
+
243
+
```javascript
244
+
importerrorHandlerfrom'./errorHandlerUtility';
245
+
246
+
functionbackendReport (string) {
247
+
// Skipping the two frames, for report() and for backendReport()
248
+
errorHandler.report(error, {skipLocalFrames:2});
249
+
}
250
+
251
+
```
252
+
238
253
## FAQ
239
254
240
255
**Q: Should I use this code in my production application?** A: This is an experimental library provided without any guarantee or official support. We do not recommend using it on production without performing a review of its code.
0 commit comments