Skip to main content

Class: ZulipError

Defined in: src/types/errors.ts:730

Zulip API error.

Remarks​

Thrown when Zulip API operations fail, such as user creation or authentication failures.

Example​

throw new ZulipError(
'Failed to create Zulip user',
400,
'user@example.com'
);

Extends​

Constructors​

new ZulipError()​

new ZulipError(message, statusCode?, email?, cause?): ZulipError

Defined in: src/types/errors.ts:751

Creates a new ZulipError.

Parameters​

message​

string

Description of the Zulip failure

statusCode?​

number

HTTP status code from Zulip API

email?​

string

Email address involved in the operation

cause?​

Error

Original error (if chained)

Returns​

ZulipError

Overrides​

ChiveError.constructor

Properties​

cause?​

readonly optional cause: Error

Defined in: src/types/errors.ts:71

Original error that caused this error (if any).

Remarks​

Error chaining allows tracking the full error context through multiple layers of the application. Useful for debugging complex error scenarios.

Example​

try {
await fetchData();
} catch (err) {
throw new ValidationError('Failed to validate data', 'field', 'required', err as Error);
}

Inherited from​

ChiveError.cause


code​

readonly code: "ZULIP_ERROR" = 'ZULIP_ERROR'

Defined in: src/types/errors.ts:731

Machine-readable error code.

Remarks​

Error codes are unique identifiers for error types, enabling programmatic error handling (switch statements, error maps), error tracking in monitoring systems, and client-side error translation (i18n).

Overrides​

ChiveError.code


email?​

readonly optional email: string

Defined in: src/types/errors.ts:741

Email of the user involved in the operation (if applicable).


statusCode?​

readonly optional statusCode: number

Defined in: src/types/errors.ts:736

HTTP status code from the Zulip API (if applicable).