mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 09:35:10 +01:00
Include PR Feedback: Check if Error.captureStackTrace is available
This commit is contained in:
parent
4f39103baf
commit
0a67766aba
@ -4,7 +4,8 @@ import invariant from 'invariant';
|
||||
|
||||
const ReactError = {
|
||||
throws(err) {
|
||||
invariant(err.handler, 'You need to specify a `handler` for this error');
|
||||
invariant(err.handler, 'Error thrown to ReactError did not have a `handler` function');
|
||||
console.logGlobal('Error thrown to ReactError did not have a `handler` function');
|
||||
err.handler(this, err);
|
||||
}
|
||||
};
|
||||
|
@ -10,8 +10,13 @@ export class ResourceNotFoundError extends Error {
|
||||
super(message);
|
||||
this.name = this.constructor.name;
|
||||
this.message = message;
|
||||
|
||||
// `captureStackTrace` might not be available in IE:
|
||||
// - http://stackoverflow.com/a/8460753/1263876
|
||||
if(Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor.name);
|
||||
}
|
||||
}
|
||||
|
||||
handler(component, err) {
|
||||
const { displayName } = component.constructor;
|
||||
|
Loading…
Reference in New Issue
Block a user