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 = {
|
const ReactError = {
|
||||||
throws(err) {
|
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);
|
err.handler(this, err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -10,7 +10,12 @@ export class ResourceNotFoundError extends Error {
|
|||||||
super(message);
|
super(message);
|
||||||
this.name = this.constructor.name;
|
this.name = this.constructor.name;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
Error.captureStackTrace(this, this.constructor.name);
|
|
||||||
|
// `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) {
|
handler(component, err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user