Skip to main content

Class: ServiceUnavailableError

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

Service unavailable error.

Remarks

Thrown when a required service is not configured or not available. Maps to HTTP 503 Service Unavailable.

Example

if (!discoveryService) {
throw new ServiceUnavailableError('Discovery service not available');
}

Extends

Constructors

new ServiceUnavailableError()

new ServiceUnavailableError(message, service?, cause?): ServiceUnavailableError

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

Creates a new ServiceUnavailableError.

Parameters

message

string

Description of the unavailability

service?

string

Name of the unavailable service

cause?

Error

Original error (if chained)

Returns

ServiceUnavailableError

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: "SERVICE_UNAVAILABLE" = 'SERVICE_UNAVAILABLE'

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

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


service?

readonly optional service: string

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

Name of the unavailable service.