@olakai/sdk
Version:
This document demonstrates how to use the Olakai SDK with all its features.
73 lines • 2.15 kB
JavaScript
;
/**
* OlakaiException is the base class for all Olakai exceptions.
* It is used to throw exceptions that are specific to Olakai SDK.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CircuitBreakerOpenError = exports.HTTPError = exports.ConfigNotInitializedError = exports.URLConfigurationError = exports.APIKeyMissingError = exports.OlakaiBlockedError = exports.OlakaiSDKError = void 0;
/**
* OlakaiSDKError is the base class for all Olakai SDK errors.
*/
class OlakaiSDKError extends Error {
constructor(message) {
super(message);
}
}
exports.OlakaiSDKError = OlakaiSDKError;
/**
* OlakaiFunctionBlocked is thrown when a function is blocked by Olakai's Control API.
*/
class OlakaiBlockedError extends OlakaiSDKError {
details;
constructor(message, details) {
super(message);
this.details = details;
}
}
exports.OlakaiBlockedError = OlakaiBlockedError;
/**
* APIKeyMissingError is thrown when an API key is missing.
*/
class APIKeyMissingError extends OlakaiSDKError {
constructor(message) {
super(message);
}
}
exports.APIKeyMissingError = APIKeyMissingError;
/**
* URLConfigurationError is thrown when a URL is not configured.
*/
class URLConfigurationError extends OlakaiSDKError {
constructor(message) {
super(message);
}
}
exports.URLConfigurationError = URLConfigurationError;
/**
* ConfigNotInitializedError is thrown when the SDK config is not initialized.
*/
class ConfigNotInitializedError extends OlakaiSDKError {
constructor(message) {
super(message);
}
}
exports.ConfigNotInitializedError = ConfigNotInitializedError;
/**
* HTTPError is thrown when an HTTP error occurs.
*/
class HTTPError extends OlakaiSDKError {
constructor(message) {
super(message);
}
}
exports.HTTPError = HTTPError;
/**
* CircuitBreakerOpenError is thrown when the circuit breaker is OPEN.
*/
class CircuitBreakerOpenError extends OlakaiSDKError {
constructor(message) {
super(message);
}
}
exports.CircuitBreakerOpenError = CircuitBreakerOpenError;
//# sourceMappingURL=exceptions.js.map