HttpApiError.ts
HttpApiError.ts overview
Section titled “HttpApiError.ts overview”Built-in error schemas for common HTTP API failure responses.
This module provides reusable Schema.ErrorClass values for common HTTP
status codes, plus HttpApiSchemaError for request decoding failures raised
by the HTTP API runtime. The status errors can be used in endpoint or
middleware error declarations and are understood by builders, generated
clients, reflection, and OpenAPI generation.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”- NoContent errors
- errors
- type IDs
NoContent errors
Section titled “NoContent errors”BadRequestNoContent
Section titled “BadRequestNoContent”No-content schema variant for BadRequest, decoding an empty 400 response into
a BadRequest error value.
Signature
declare const BadRequestNoContent: HttpApiSchema.asNoContent<typeof BadRequest>Since v4.0.0
ConflictNoContent
Section titled “ConflictNoContent”No-content schema variant for Conflict, decoding an empty 409 response into a
Conflict error value.
Signature
declare const ConflictNoContent: HttpApiSchema.asNoContent<typeof Conflict>Since v4.0.0
ForbiddenNoContent
Section titled “ForbiddenNoContent”No-content schema variant for Forbidden, decoding an empty 403 response into a
Forbidden error value.
Signature
declare const ForbiddenNoContent: HttpApiSchema.asNoContent<typeof Forbidden>Since v4.0.0
GoneNoContent
Section titled “GoneNoContent”No-content schema variant for Gone, decoding an empty 410 response into a
Gone error value.
Signature
declare const GoneNoContent: HttpApiSchema.asNoContent<typeof Gone>Since v4.0.0
InternalServerErrorNoContent
Section titled “InternalServerErrorNoContent”No-content schema variant for InternalServerError, decoding an empty 500
response into an InternalServerError error value.
Signature
declare const InternalServerErrorNoContent: HttpApiSchema.asNoContent<typeof InternalServerError>Since v4.0.0
MethodNotAllowedNoContent
Section titled “MethodNotAllowedNoContent”No-content schema variant for MethodNotAllowed, decoding an empty 405 response
into a MethodNotAllowed error value.
Signature
declare const MethodNotAllowedNoContent: HttpApiSchema.asNoContent<typeof MethodNotAllowed>Since v4.0.0
NotAcceptableNoContent
Section titled “NotAcceptableNoContent”No-content schema variant for NotAcceptable, decoding an empty 406 response
into a NotAcceptable error value.
Signature
declare const NotAcceptableNoContent: HttpApiSchema.asNoContent<typeof NotAcceptable>Since v4.0.0
NotFoundNoContent
Section titled “NotFoundNoContent”No-content schema variant for NotFound, decoding an empty 404 response into a
NotFound error value.
Signature
declare const NotFoundNoContent: HttpApiSchema.asNoContent<typeof NotFound>Since v4.0.0
NotImplementedNoContent
Section titled “NotImplementedNoContent”No-content schema variant for NotImplemented, decoding an empty 501 response
into a NotImplemented error value.
Signature
declare const NotImplementedNoContent: HttpApiSchema.asNoContent<typeof NotImplemented>Since v4.0.0
RequestTimeoutNoContent
Section titled “RequestTimeoutNoContent”No-content schema variant for RequestTimeout, decoding an empty 408 response
into a RequestTimeout error value.
Signature
declare const RequestTimeoutNoContent: HttpApiSchema.asNoContent<typeof RequestTimeout>Since v4.0.0
ServiceUnavailableNoContent
Section titled “ServiceUnavailableNoContent”No-content schema variant for ServiceUnavailable, decoding an empty 503
response into a ServiceUnavailable error value.
Signature
declare const ServiceUnavailableNoContent: HttpApiSchema.asNoContent<typeof ServiceUnavailable>Since v4.0.0
UnauthorizedNoContent
Section titled “UnauthorizedNoContent”No-content schema variant for Unauthorized, decoding an empty 401 response
into an Unauthorized error value.
Signature
declare const UnauthorizedNoContent: HttpApiSchema.asNoContent<typeof Unauthorized>Since v4.0.0
errors
Section titled “errors”BadRequest (class)
Section titled “BadRequest (class)”Built-in HTTP API error for a 400 Bad Request response. When used directly as
a server response, it renders as an empty response with status 400.
Signature
declare class BadRequestSince v4.0.0
[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>[ErrorReporter.ignore] (property)
Section titled “[ErrorReporter.ignore] (property)”Signature
readonly [ErrorReporter.ignore]: trueConflict (class)
Section titled “Conflict (class)”Built-in HTTP API error for a 409 Conflict response. When used directly as a
server response, it renders as an empty response with status 409.
Signature
declare class ConflictSince v4.0.0
[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>[ErrorReporter.ignore] (property)
Section titled “[ErrorReporter.ignore] (property)”Signature
readonly [ErrorReporter.ignore]: trueForbidden (class)
Section titled “Forbidden (class)”Built-in HTTP API error for a 403 Forbidden response. When used directly as a
server response, it renders as an empty response with status 403.
Signature
declare class ForbiddenSince v4.0.0
[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>[ErrorReporter.ignore] (property)
Section titled “[ErrorReporter.ignore] (property)”Signature
readonly [ErrorReporter.ignore]: trueGone (class)
Section titled “Gone (class)”Built-in HTTP API error for a 410 Gone response. When used directly as a
server response, it renders as an empty response with status 410.
Signature
declare class GoneSince v4.0.0
[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>[ErrorReporter.ignore] (property)
Section titled “[ErrorReporter.ignore] (property)”Signature
readonly [ErrorReporter.ignore]: trueHttpApiSchemaError (class)
Section titled “HttpApiSchemaError (class)”Error raised when an HTTP API request component fails schema decoding. It records
which component failed and responds as an empty 400 Bad Request when rendered
as a server response.
Signature
declare class HttpApiSchemaErrorSince v4.0.0
is (static method)
Section titled “is (static method)”Signature
declare const is: (u: unknown) => u is HttpApiSchemaErrorwrap (static method)
Section titled “wrap (static method)”Signature
declare const wrap: <A, R>( kind: HttpApiSchemaError["kind"], effect: Effect.Effect<A, Schema.SchemaError, R>) => Effect.Effect<A, HttpApiSchemaError, R>[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>[HttpApiSchemaErrorTypeId] (property)
Section titled “[HttpApiSchemaErrorTypeId] (property)”Signature
readonly [HttpApiSchemaErrorTypeId]: "~effect/httpapi/HttpApiError/HttpApiSchemaError"name (property)
Section titled “name (property)”Signature
readonly name: "HttpApiSchemaError"message (property)
Section titled “message (property)”Signature
readonly message: "Params" | "Headers" | "Query" | "Body" | "Payload"InternalServerError (class)
Section titled “InternalServerError (class)”Built-in HTTP API error for a 500 Internal Server Error response. When used
directly as a server response, it renders as an empty response with status 500.
Signature
declare class InternalServerErrorSince v4.0.0
[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>MethodNotAllowed (class)
Section titled “MethodNotAllowed (class)”Built-in HTTP API error for a 405 Method Not Allowed response. When used
directly as a server response, it renders as an empty response with status 405.
Signature
declare class MethodNotAllowedSince v4.0.0
[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>[ErrorReporter.ignore] (property)
Section titled “[ErrorReporter.ignore] (property)”Signature
readonly [ErrorReporter.ignore]: trueNotAcceptable (class)
Section titled “NotAcceptable (class)”Built-in HTTP API error for a 406 Not Acceptable response. When used directly
as a server response, it renders as an empty response with status 406.
Signature
declare class NotAcceptableSince v4.0.0
[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>[ErrorReporter.ignore] (property)
Section titled “[ErrorReporter.ignore] (property)”Signature
readonly [ErrorReporter.ignore]: trueNotFound (class)
Section titled “NotFound (class)”Built-in HTTP API error for a 404 Not Found response. When used directly as a
server response, it renders as an empty response with status 404.
Signature
declare class NotFoundSince v4.0.0
[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>[ErrorReporter.ignore] (property)
Section titled “[ErrorReporter.ignore] (property)”Signature
readonly [ErrorReporter.ignore]: trueNotImplemented (class)
Section titled “NotImplemented (class)”Built-in HTTP API error for a 501 Not Implemented response. When used directly
as a server response, it renders as an empty response with status 501.
Signature
declare class NotImplementedSince v4.0.0
[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>RequestTimeout (class)
Section titled “RequestTimeout (class)”Built-in HTTP API error for a 408 Request Timeout response. When used directly
as a server response, it renders as an empty response with status 408.
Signature
declare class RequestTimeoutSince v4.0.0
[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>[ErrorReporter.ignore] (property)
Section titled “[ErrorReporter.ignore] (property)”Signature
readonly [ErrorReporter.ignore]: trueServiceUnavailable (class)
Section titled “ServiceUnavailable (class)”Built-in HTTP API error for a 503 Service Unavailable response. When used
directly as a server response, it renders as an empty response with status 503.
Signature
declare class ServiceUnavailableSince v4.0.0
[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>Unauthorized (class)
Section titled “Unauthorized (class)”Built-in HTTP API error for a 401 Unauthorized response. When used directly as
a server response, it renders as an empty response with status 401.
Signature
declare class UnauthorizedSince v4.0.0
[HttpServerRespondable.symbol] (method)
Section titled “[HttpServerRespondable.symbol] (method)”Signature
declare const [HttpServerRespondable.symbol]: () => Effect.Effect<HttpServerResponse.HttpServerResponse, never, never>[ErrorReporter.ignore] (property)
Section titled “[ErrorReporter.ignore] (property)”Signature
readonly [ErrorReporter.ignore]: truetype IDs
Section titled “type IDs”HttpApiSchemaErrorTypeId
Section titled “HttpApiSchemaErrorTypeId”Runtime identifier used to mark and detect HttpApiSchemaError values.
Signature
declare const HttpApiSchemaErrorTypeId: "~effect/httpapi/HttpApiError/HttpApiSchemaError"Since v4.0.0
HttpApiSchemaErrorTypeId (type alias)
Section titled “HttpApiSchemaErrorTypeId (type alias)”Type-level identifier used to mark HttpApiSchemaError values.
Signature
type HttpApiSchemaErrorTypeId = "~effect/httpapi/HttpApiError/HttpApiSchemaError"Since v4.0.0