@oxyhq/services
Version:
Reusable OxyHQ module to handle authentication, user management, karma system, device-based session management and more 🚀
26 lines (25 loc) • 965 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.OxyAuthenticationTimeoutError = exports.OxyAuthenticationError = void 0;
/**
* Custom error types for better error handling
*/
class OxyAuthenticationError extends Error {
constructor(message, code = 'AUTH_ERROR', status = 401) {
super(message);
this.name = 'OxyAuthenticationError';
this.code = code;
this.status = status;
}
}
exports.OxyAuthenticationError = OxyAuthenticationError;
class OxyAuthenticationTimeoutError extends OxyAuthenticationError {
constructor(operationName, timeoutMs) {
super(`Authentication timeout (${timeoutMs}ms): ${operationName} requires user authentication. Please ensure the user is logged in before calling this method.`, 'AUTH_TIMEOUT', 408);
this.name = 'OxyAuthenticationTimeoutError';
}
}
exports.OxyAuthenticationTimeoutError = OxyAuthenticationTimeoutError;
//# sourceMappingURL=OxyServices.errors.js.map