@noony-serverless/core
Version:
A Middy base framework compatible with Firebase and GCP Cloud Functions with TypeScript
68 lines • 2.29 kB
TypeScript
export declare class HttpError extends Error {
status: number;
code?: string;
details?: unknown;
constructor(status: number, message: string, code?: string, details?: unknown);
}
export declare class ValidationError extends HttpError {
constructor(message: string, details?: unknown);
}
export declare class AuthenticationError extends HttpError {
constructor(message?: string);
}
export declare class BusinessError extends HttpError {
constructor(message: string, status?: number, details?: unknown);
}
export declare class SecurityError extends HttpError {
constructor(message?: string, details?: unknown);
}
export declare class TimeoutError extends HttpError {
constructor(message?: string, details?: unknown);
}
export declare class TooLargeError extends HttpError {
constructor(message?: string, details?: unknown);
}
/**
* 401 Unauthorized - Authentication required
* Alias for AuthenticationError for better semantic clarity
*/
export declare class UnauthorizedError extends HttpError {
constructor(message?: string);
}
/**
* 403 Forbidden - Insufficient permissions
* Use this for authorization failures (user is authenticated but lacks permission)
*/
export declare class ForbiddenError extends HttpError {
constructor(message?: string, details?: unknown);
}
/**
* 404 Not Found - Resource not found
*/
export declare class NotFoundError extends HttpError {
constructor(message?: string, details?: unknown);
}
/**
* 409 Conflict - Resource already exists or state conflict
*/
export declare class ConflictError extends HttpError {
constructor(message?: string, details?: unknown);
}
/**
* 500 Internal Server Error - Unexpected errors with optional cause chaining
*/
export declare class InternalServerError extends HttpError {
cause?: Error | undefined;
constructor(message?: string, cause?: Error | undefined, details?: unknown);
}
/**
* Service layer error with error code
* Use this in service classes for business logic errors
* Not tied to specific HTTP status codes
*/
export declare class ServiceError extends Error {
code: string;
details?: unknown | undefined;
constructor(message: string, code: string, details?: unknown | undefined);
}
//# sourceMappingURL=errors.d.ts.map