Skip to content

ErrorWrapper

An error that wraps a non-Error value that was thrown, preserving the original value in cause.

Import:

import { ErrorWrapper } from 'obsidian-dev-utils/error';

Signature:

export class ErrorWrapper extends Error

Extends: Error

Constructor

new ErrorWrapper(thrownValue: unknown)

Creates a new ErrorWrapper.

Methods

MethodReturnsDescription
static create(thrownValue)ErrorNormalizes any thrown value to an Error.

Returns the value unchanged if it is already an Error, otherwise wraps it in an ErrorWrapper.