token-guardian
Version:
A comprehensive solution for protecting and managing API tokens and secrets
34 lines • 1.03 kB
JavaScript
/**
* Custom error class for token rotation errors
*/
export class RotationError extends Error {
code;
details;
constructor(message, code = 'ROTATION_ERROR', details) {
super(message);
this.code = code;
this.details = details;
this.name = 'RotationError';
// Ensure proper prototype chain for instanceof checks
Object.setPrototypeOf(this, RotationError.prototype);
}
/**
* Create a RotationError for validation failures
*/
static validationError(message, details) {
return new RotationError(message, 'VALIDATION_ERROR', details);
}
/**
* Create a RotationError for API errors
*/
static apiError(message, details) {
return new RotationError(message, 'API_ERROR', details);
}
/**
* Create a RotationError for configuration errors
*/
static configError(message, details) {
return new RotationError(message, 'CONFIG_ERROR', details);
}
}
//# sourceMappingURL=RotationError.js.map