Creates a new instance.
The type of the error.
The error details object. This object must contain code
and info
properties. Other properties are merged into the data
property of the new instance.
Optional
data: MwbotErrorDataOptional object to initialize the data
property with.
Optional
causeThe code of the error.
Optional
dataAdditional data of the error.
The information of the error.
Optional
stackThe type of the error.
Static
Optional
prepareOptional override for formatting stack traces
Static
stackReturns the info property. This property is only for compatibility with the parent Error class.
Updates the error code.
The new error code.
The current instance for chaining.
Updates the error information.
The new error information.
The current instance for chaining.
Static
captureCreate .stack property on a target object
Optional
constructorOpt: FunctionStatic
newCreates a new instance from an API error response.
An API response with the error
or errors
property.
A new MwbotError instance.
Custom error class for Mwbot, extending the built-in
Error
class. This class is exported for use with theinstanceof
operator.This error class is used throughout Mwbot to standardize error handling, ensuring that all errors and rejected Promises include a stack trace for easier debugging.
For a list of error codes, see MwbotErrorCodes.