@suluk/hono - v0.1.5
    Preparing search index...

    Variable HttpErrorsConst

    HttpErrors: {
        unauthorized: (detail?: string) => SulukHttpError;
        forbidden: (detail?: string, resource?: string) => SulukHttpError;
        invalidApiKey: (reason: string) => SulukHttpError;
        validation: (
            message: string,
            details?: Record<string, unknown>,
        ) => SulukHttpError;
        notFound: (resource: string, id?: string) => SulukHttpError;
        conflict: (message: string) => SulukHttpError;
        payment: (message: string, code?: string) => SulukHttpError;
        invalidDiscount: (code: string, reason: string) => SulukHttpError;
        externalService: (
            service: string,
            operation: string,
            cause?: unknown,
        ) => SulukHttpError;
        rateLimited: (retryAfterMs: number) => SulukHttpError;
        internal: (message?: string, cause?: unknown) => SulukHttpError;
    } = ...

    Factory helpers mirroring saastarter's TaggedError set (errors.ts) with the SAME field semantics the route-handler rendered (route-handler.ts:24-86). externalService/internal keep their detail GENERIC on the wire and stash the cause in logContext (route-handler.ts:63,81 log it server-side, never leak it).

    Type Declaration

    • unauthorized: (detail?: string) => SulukHttpError

      401 (route-handler.ts:26-30).

    • forbidden: (detail?: string, resource?: string) => SulukHttpError

      403 (route-handler.ts:32-36); resource becomes the instance.

    • invalidApiKey: (reason: string) => SulukHttpError

      401 (route-handler.ts:38-39); the key reason is the detail.

    • validation: (message: string, details?: Record<string, unknown>) => SulukHttpError

      400 (route-handler.ts:41-45); detailserrors.

    • notFound: (resource: string, id?: string) => SulukHttpError

      404 (route-handler.ts:47-51); detail is ${resource} not found, id → instance.

    • conflict: (message: string) => SulukHttpError

      409 (route-handler.ts:53-54).

    • payment: (message: string, code?: string) => SulukHttpError

      402 (route-handler.ts:56-57); optional Stripe-style code → errors.

    • invalidDiscount: (code: string, reason: string) => SulukHttpError

      400 (route-handler.ts:59-60); the discount code → errors, reason → detail.

    • externalService: (service: string, operation: string, cause?: unknown) => SulukHttpError

      502 (route-handler.ts:62-67); GENERIC wire detail, cause logged only.

    • rateLimited: (retryAfterMs: number) => SulukHttpError

      429 (route-handler.ts:69-78); retryAfterMs drives the Retry-After header.

    • internal: (message?: string, cause?: unknown) => SulukHttpError

      500 (route-handler.ts:80-85); GENERIC wire detail, cause logged only.