@re-auth/http-adapters
Version:
HTTP protocol adapters for ReAuth - framework-agnostic integration with Express, Fastify, and Hono
51 lines (49 loc) • 1.57 kB
JavaScript
;
// src/types.ts
var HttpAdapterError = class extends Error {
constructor(message, statusCode = 500, code = "INTERNAL_ERROR", details) {
super(message);
this.statusCode = statusCode;
this.code = code;
this.details = details;
this.name = "HttpAdapterError";
}
};
var ValidationError = class extends HttpAdapterError {
constructor(message, details) {
super(message, 400, "VALIDATION_ERROR", details);
this.name = "ValidationError";
}
};
var AuthenticationError = class extends HttpAdapterError {
constructor(message, details) {
super(message, 401, "AUTHENTICATION_ERROR", details);
this.name = "AuthenticationError";
}
};
var AuthorizationError = class extends HttpAdapterError {
constructor(message, details) {
super(message, 403, "AUTHORIZATION_ERROR", details);
this.name = "AuthorizationError";
}
};
var NotFoundError = class extends HttpAdapterError {
constructor(message, details) {
super(message, 404, "NOT_FOUND", details);
this.name = "NotFoundError";
}
};
var RateLimitError = class extends HttpAdapterError {
constructor(message, details) {
super(message, 429, "RATE_LIMIT_EXCEEDED", details);
this.name = "RateLimitError";
}
};
exports.AuthenticationError = AuthenticationError;
exports.AuthorizationError = AuthorizationError;
exports.HttpAdapterError = HttpAdapterError;
exports.NotFoundError = NotFoundError;
exports.RateLimitError = RateLimitError;
exports.ValidationError = ValidationError;
//# sourceMappingURL=types.cjs.map
//# sourceMappingURL=types.cjs.map