@wpkernel/core / EnvironmentalError
Class: EnvironmentalError
Error thrown when environment or readiness preconditions fail.
Extends
Constructors
Constructor
ts
new EnvironmentalError(reason, options): EnvironmentalError;Parameters
reason
string
options
EnvironmentalErrorOptions = {}
Returns
EnvironmentalError
Overrides
Properties
code
ts
readonly code: ErrorCode;Error code - identifies the type of error
Inherited from
reason
ts
readonly reason: string;context?
ts
readonly optional context: ErrorContext;Context in which the error occurred
Inherited from
data?
ts
readonly optional data: ErrorData;Additional data about the error
Inherited from
Methods
fromJSON()
ts
static fromJSON(serialized): WPKernelError;Create WPKernelError from serialized format
Parameters
serialized
Serialized error object
Returns
New WPKernelError instance
Inherited from
isWPKernelError()
ts
static isWPKernelError(error): error is WPKernelError;Check if an error is a WPKernelError
Parameters
error
unknown
Error to check
Returns
error is WPKernelError
True if error is a WPKernelError
Inherited from
toJSON()
ts
toJSON(): SerializedError;Serialize error to JSON-safe format
Returns
Serialized error object
Inherited from
wrap()
ts
static wrap(
error,
code,
context?): WPKernelError;Wrap a native Error into a WPKernelError
Parameters
error
Error
Native error to wrap
code
ErrorCode = 'UnknownError'
Error code to assign
context?
Additional context
Returns
New WPKernelError wrapping the original
