
Research
TeamPCP Compromises Telnyx Python SDK to Deliver Credential-Stealing Malware
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.
@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 1,051 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.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.

Security News
/Research
Widespread GitHub phishing campaign uses fake Visual Studio Code security alerts in Discussions to trick developers into visiting malicious website.