
Research
/Security News
Trivy Under Attack Again: Widespread GitHub Actions Tag Compromise Exposes CI/CD Secrets
Attackers compromised Trivy GitHub Actions by force-updating tags to deliver malware, exposing CI/CD secrets across affected pipelines.
@xylabs/error
Advanced tools
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
@xylabs/error
| Type Alias | Description |
|---|---|
| AssertConfig | Configuration for assertion behavior: a static message string, a boolean toggle, or a callback. |
| Function | Description |
|---|---|
| assertError | Throws an Error based on the assert configuration when a value fails validation. |
| handleError | Invokes the handler if the value is an Error, otherwise re-throws it. |
| handleErrorAsync | Async version of handleError. Invokes the async handler if the value is an Error, otherwise re-throws it. |
| isError | Type guard that checks whether a value is an Error instance. |
function assertError(
value: unknown,
assert: AssertConfig | undefined,
defaultMessage: string): undefined;
Throws an Error based on the assert configuration when a value fails validation.
| Parameter | Type | Description |
|---|---|---|
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 |
undefined
function handleError<T>(error: any, handler: (error: Error) => T): T;
Invokes the handler if the value is an Error, otherwise re-throws it.
| Type Parameter |
|---|
T |
| Parameter | Type | Description |
|---|---|---|
error | any | The caught value to inspect |
handler | (error: Error) => T | Callback invoked with the Error if it is one |
T
The handler's return value
function handleErrorAsync<T>(error: any, handler: (error: Error) => Promise<T>): Promise<T>;
Async version of handleError. Invokes the async handler if the value is an Error, otherwise re-throws it.
| Type Parameter |
|---|
T |
| Parameter | Type | Description |
|---|---|---|
error | any | The caught value to inspect |
handler | (error: Error) => Promise<T> | Async callback invoked with the Error if it is one |
Promise<T>
The handler's resolved return value
function isError(value: unknown): value is Error;
Type guard that checks whether a value is an Error instance.
| Parameter | Type |
|---|---|
value | unknown |
value is Error
function isError<T>(value: T): value is Extract<T, Error>;
Type guard that checks whether a value is an Error instance.
| Type Parameter |
|---|
T |
| Parameter | Type |
|---|---|
value | T |
value is Extract<T, Error>
type AssertConfig = string | AssertCallback | boolean;
Configuration for assertion behavior: a static message string, a boolean toggle, or a callback.
Part of sdk-js
See the LICENSE file for license details
FAQs
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
The npm package @xylabs/error receives a total of 237 weekly downloads. As such, @xylabs/error popularity was classified as not 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.

Research
/Security News
Attackers compromised Trivy GitHub Actions by force-updating tags to deliver malware, exposing CI/CD secrets across affected pipelines.

Security News
ENISA’s new package manager advisory outlines the dependency security practices companies will need to demonstrate as the EU’s Cyber Resilience Act begins enforcing software supply chain requirements.

Research
/Security News
We identified over 20 additional malicious extensions, along with over 20 related sleeper extensions, some of which have already been weaponized.