
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
@xylabs/error
Advanced tools
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Using npm:
npm install {{name}}
Using yarn:
yarn add {{name}}
Using pnpm:
pnpm add {{name}}
Using bun:
bun add {{name}}
See the LICENSE file for license rights and limitations (LGPL-3.0-only).
### .temp-typedoc
### functions
### <a id="assertError"></a>assertError
function assertError(
value,
assert,
defaultMessage): undefined;
Throws an Error based on the assert configuration when a value fails validation.
unknown
The value being validated
AssertConfig | undefined
Assertion config controlling the error message
string
Fallback message if no custom message is provided
undefined
### <a id="handleError"></a>handleError
function handleError<T>(error, handler): T;
Invokes the handler if the value is an Error, otherwise re-throws it.
T
any
The caught value to inspect
(error) => T
Callback invoked with the Error if it is one
T
The handler's return value
### <a id="handleErrorAsync"></a>handleErrorAsync
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.
T
any
The caught value to inspect
(error) => Promise<T>
Async callback invoked with the Error if it is one
Promise<T>
The handler's resolved return value
### type-aliases
### <a id="AssertConfig"></a>AssertConfig
type AssertConfig = string | AssertCallback | boolean;
Configuration for assertion behavior: a static message string, a boolean toggle, or a callback.
FAQs
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
The npm package @xylabs/error receives a total of 9,481 weekly downloads. As such, @xylabs/error popularity was classified as popular.
We found that @xylabs/error demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

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.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.