Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@xylabs/error

Package Overview
Dependencies
Maintainers
5
Versions
447
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xylabs/error

Base functionality used throughout XY Labs TypeScript/JavaScript libraries

Source
npmnpm
Version
5.1.5
Version published
Weekly downloads
9.4K
28.31%
Maintainers
5
Weekly downloads
 
Created
Source

@xylabs/error

npm license

Base functionality used throughout XY Labs TypeScript/JavaScript libraries

Install

Using npm:

npm install {{name}}

Using yarn:

yarn add {{name}}

Using pnpm:

pnpm add {{name}}

Using bun:

bun add {{name}}

License

See the LICENSE file for license rights and limitations (LGPL-3.0-only).

Reference

packages

error

### .temp-typedoc

  ### functions

    ### <a id="assertError"></a>assertError

@xylabs/error

function assertError(
   value, 
   assert, 
   defaultMessage): undefined;

Throws an Error based on the assert configuration when a value fails validation.

Parameters

value

unknown

The value being validated

assert

AssertConfig | undefined

Assertion config controlling the error message

defaultMessage

string

Fallback message if no custom message is provided

Returns

undefined

    ### <a id="handleError"></a>handleError

@xylabs/error

function handleError<T>(error, handler): T;

Invokes the handler if the value is an Error, otherwise re-throws it.

Type Parameters

T

T

Parameters

error

any

The caught value to inspect

handler

(error) => T

Callback invoked with the Error if it is one

Returns

T

The handler's return value

    ### <a id="handleErrorAsync"></a>handleErrorAsync

@xylabs/error

function handleErrorAsync<T>(error, handler): Promise<T>;

Async version of handleError. Invokes the async handler if the value is an Error, otherwise re-throws it.

Type Parameters

T

T

Parameters

error

any

The caught value to inspect

handler

(error) => Promise<T>

Async callback invoked with the Error if it is one

Returns

Promise<T>

The handler's resolved return value

  ### type-aliases

    ### <a id="AssertConfig"></a>AssertConfig

@xylabs/error

type AssertConfig = string | AssertCallback | boolean;

Configuration for assertion behavior: a static message string, a boolean toggle, or a callback.

Keywords

error

FAQs

Package last updated on 18 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts