@kiryano/etherealotp
Version:
A library for two-factor authentication using Twilio and Speakeasy.
27 lines (26 loc) • 1.13 kB
JavaScript
;
// File: src/errors/TokenErrors.ts
Object.defineProperty(exports, "__esModule", { value: true });
exports.TokenVerificationError = exports.TokenGenerationError = void 0;
/**
* Represents errors related to token generation failures.
*/
class TokenGenerationError extends Error {
constructor(message) {
super(`TokenGenerationError: ${message}`); // Prefix error messages for clarity
this.name = 'TokenGenerationError'; // Set the error name to the class name
Object.setPrototypeOf(this, TokenGenerationError.prototype); // Restore prototype chain
}
}
exports.TokenGenerationError = TokenGenerationError;
/**
* Represents errors related to token verification failures.
*/
class TokenVerificationError extends Error {
constructor(message) {
super(`TokenVerificationError: ${message}`); // Prefix error messages for clarity
this.name = 'TokenVerificationError'; // Set the error name to the class name
Object.setPrototypeOf(this, TokenVerificationError.prototype); // Restore prototype chain
}
}
exports.TokenVerificationError = TokenVerificationError;