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
Instead of passing an Object, it should be possible to pass a function that would act as a custom constructor. This custom constructor would be invoked before calling the base prototype and, therefore, before generating the stack trace.
Note: the Error object constructor uses this.message to generate the stack trace, therefore the message content must be set beforehand.
When using a custom constructor, this._super is provided to invoke the base type constructor, event Error itself.
For example :
varBaseError=errorFactory('BaseError', ...);varCustomError=errorFactory('CustomError',function(message,status){this.status=status||400;this._super(message);// ex: invoke some event listener},BaseError);
Note: this._super(...) or this.base(...) ?
Internally, the base type constructor is invoked as
function_super(){baseType.apply(this,arguments);}
The text was updated successfully, but these errors were encountered:
Instead of passing an
Object
, it should be possible to pass a function that would act as a custom constructor. This custom constructor would be invoked before calling the base prototype and, therefore, before generating the stack trace.Note: the
Error
object constructor usesthis.message
to generate the stack trace, therefore the message content must be set beforehand.When using a custom constructor,
this._super
is provided to invoke the base type constructor, eventError
itself.For example :
Note:
this._super(...)
orthis.base(...)
?Internally, the base type constructor is invoked as
The text was updated successfully, but these errors were encountered: