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?,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
Overrides
Properties
cause?
readonlyoptionalcause: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
code
readonlycode:"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
email?
readonlyoptionalemail:string
Defined in: src/types/errors.ts:741
Email of the user involved in the operation (if applicable).
statusCode?
readonlyoptionalstatusCode:number
Defined in: src/types/errors.ts:736
HTTP status code from the Zulip API (if applicable).