quallaa-cli
Version:
Sets up core infrastructure services for AI-assisted development
72 lines • 2.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CredentialStorageError = exports.ConfigurationError = exports.ValidationError = exports.ServiceError = exports.AuthenticationError = exports.QuallaaError = void 0;
const package_json_1 = require("../../../package.json");
class QuallaaError extends Error {
code;
version;
timestamp;
constructor(message, code = 'UNKNOWN_ERROR') {
super(message);
this.name = 'QuallaaError';
this.code = code;
this.version = package_json_1.version;
this.timestamp = new Date().toISOString();
Error.captureStackTrace(this, QuallaaError);
}
toJSON() {
return {
name: this.name,
message: this.message,
code: this.code,
version: this.version,
timestamp: this.timestamp,
stack: this.stack,
};
}
}
exports.QuallaaError = QuallaaError;
class AuthenticationError extends QuallaaError {
constructor(message, service) {
super(service ? `${service} authentication failed: ${message}` : message, 'AUTH_ERROR');
this.name = 'AuthenticationError';
}
}
exports.AuthenticationError = AuthenticationError;
class ServiceError extends QuallaaError {
service;
statusCode;
constructor(message, service, statusCode) {
super(`${service} service error: ${message}`, 'SERVICE_ERROR');
this.name = 'ServiceError';
this.service = service;
this.statusCode = statusCode;
}
}
exports.ServiceError = ServiceError;
class ValidationError extends QuallaaError {
field;
constructor(message, field) {
super(field ? `Validation error for ${field}: ${message}` : message, 'VALIDATION_ERROR');
this.name = 'ValidationError';
this.field = field;
}
}
exports.ValidationError = ValidationError;
class ConfigurationError extends QuallaaError {
constructor(message) {
super(`Configuration error: ${message}`, 'CONFIG_ERROR');
this.name = 'ConfigurationError';
}
}
exports.ConfigurationError = ConfigurationError;
class CredentialStorageError extends QuallaaError {
operation;
constructor(message, operation) {
super(`Credential storage error (${operation}): ${message}`, 'CREDENTIAL_ERROR');
this.name = 'CredentialStorageError';
this.operation = operation;
}
}
exports.CredentialStorageError = CredentialStorageError;
//# sourceMappingURL=custom-errors.js.map