HttpApiError
Built-in error schemas for common HTTP API failure responses.
This module provides reusable Schema.Error 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.
Errors
BadRequest
Signature
declare class BadRequest extends {
readonly _tag: "BadRequest";
} & YieldableError<this> {
constructor(...args: [props?: {
readonly _tag?: "BadRequest";
}, options?: MakeOptions]);
readonly "~effect/ErrorReporter/ignore": true;
static readonly singleton: BadRequest;
"~effect/http/HttpServerRespondable"(): Effect<HttpServerResponse, never, never>;
}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 Conflict extends {
readonly _tag: "Conflict";
} & YieldableError<this> {
constructor(...args: [props?: {
readonly _tag?: "Conflict";
}, options?: MakeOptions]);
readonly "~effect/ErrorReporter/ignore": true;
"~effect/http/HttpServerRespondable"(): Effect<HttpServerResponse, never, never>;
}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 Forbidden extends {
readonly _tag: "Forbidden";
} & YieldableError<this> {
constructor(...args: [props?: {
readonly _tag?: "Forbidden";
}, options?: MakeOptions]);
readonly "~effect/ErrorReporter/ignore": true;
"~effect/http/HttpServerRespondable"(): Effect<HttpServerResponse, never, never>;
}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 Gone extends {
readonly _tag: "Gone";
} & YieldableError<this> {
constructor(...args: [props?: {
readonly _tag?: "Gone";
}, options?: MakeOptions]);
readonly "~effect/ErrorReporter/ignore": true;
"~effect/http/HttpServerRespondable"(): Effect<HttpServerResponse, never, never>;
}HttpApiSchemaError
Error raised when an HTTP API request or response component fails schema decoding or encoding. It records which component failed and responds as an empty 400 Bad Request when rendered as a server response.
Signature
declare class HttpApiSchemaError extends Readonly<{
readonly cause: SchemaError;
readonly kind: "Headers" | "Params" | "Query" | "Body" | "Payload" | "ResponseHeaders";
}> & {
readonly _tag: "HttpApiSchemaError";
} & Pipeable {
constructor(args: {
readonly cause: SchemaError;
readonly kind: "Headers" | "Params" | "Query" | "Body" | "Payload" | "ResponseHeaders";
});
readonly "~effect/httpapi/HttpApiError/HttpApiSchemaError": "~effect/httpapi/HttpApiError/HttpApiSchemaError";
readonly message: "Headers" | "Params" | "Query" | "Body" | "Payload" | "ResponseHeaders";
readonly name: "HttpApiSchemaError";
"~effect/http/HttpServerRespondable"(): Effect<HttpServerResponse, never, never>;
static is(u: unknown): u is HttpApiSchemaError;
static wrap<A, R>(kind: "Headers" | "Params" | "Query" | "Body" | "Payload" | "ResponseHeaders", effect: Effect<A, SchemaError, R>): Effect<A, HttpApiSchemaError, R>;
}InternalServerError
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 InternalServerError extends {
readonly _tag: "InternalServerError";
} & YieldableError<this> {
constructor(...args: [props?: {
readonly _tag?: "InternalServerError";
}, options?: MakeOptions]);
"~effect/http/HttpServerRespondable"(): Effect<HttpServerResponse, never, never>;
}MethodNotAllowed
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 MethodNotAllowed extends {
readonly _tag: "MethodNotAllowed";
} & YieldableError<this> {
constructor(...args: [props?: {
readonly _tag?: "MethodNotAllowed";
}, options?: MakeOptions]);
readonly "~effect/ErrorReporter/ignore": true;
"~effect/http/HttpServerRespondable"(): Effect<HttpServerResponse, never, never>;
}NotAcceptable
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 NotAcceptable extends {
readonly _tag: "NotAcceptable";
} & YieldableError<this> {
constructor(...args: [props?: {
readonly _tag?: "NotAcceptable";
}, options?: MakeOptions]);
readonly "~effect/ErrorReporter/ignore": true;
"~effect/http/HttpServerRespondable"(): Effect<HttpServerResponse, never, never>;
}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 NotFound extends {
readonly _tag: "NotFound";
} & YieldableError<this> {
constructor(...args: [props?: {
readonly _tag?: "NotFound";
}, options?: MakeOptions]);
readonly "~effect/ErrorReporter/ignore": true;
"~effect/http/HttpServerRespondable"(): Effect<HttpServerResponse, never, never>;
}NotImplemented
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 NotImplemented extends {
readonly _tag: "NotImplemented";
} & YieldableError<this> {
constructor(...args: [props?: {
readonly _tag?: "NotImplemented";
}, options?: MakeOptions]);
"~effect/http/HttpServerRespondable"(): Effect<HttpServerResponse, never, never>;
}RequestTimeout
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 RequestTimeout extends {
readonly _tag: "RequestTimeout";
} & YieldableError<this> {
constructor(...args: [props?: {
readonly _tag?: "RequestTimeout";
}, options?: MakeOptions]);
readonly "~effect/ErrorReporter/ignore": true;
"~effect/http/HttpServerRespondable"(): Effect<HttpServerResponse, never, never>;
}UnprocessableEntity
Built-in HTTP API error for a 422 Unprocessable Entity response. When used directly as a server response, it renders as an empty response with status 422.
Signature
declare class UnprocessableEntity extends {
readonly _tag: "UnprocessableEntity";
} & YieldableError<this> {
constructor(...args: [props?: {
readonly _tag?: "UnprocessableEntity";
}, options?: MakeOptions]);
readonly "~effect/ErrorReporter/ignore": true;
"~effect/http/HttpServerRespondable"(): Effect<HttpServerResponse, never, never>;
}Schemas
BadRequestNoContent
No-content schema variant for BadRequest, decoding an empty 400 response into a BadRequest error value.
Signature
declare const BadRequestNoContent: asNoContent<typeof BadRequest>;ConflictNoContent
No-content schema variant for Conflict, decoding an empty 409 response into a Conflict error value.
Signature
declare const ConflictNoContent: asNoContent<typeof Conflict>;ForbiddenNoContent
No-content schema variant for Forbidden, decoding an empty 403 response into a Forbidden error value.
Signature
declare const ForbiddenNoContent: asNoContent<typeof Forbidden>;GoneNoContent
No-content schema variant for Gone, decoding an empty 410 response into a Gone error value.
Signature
declare const GoneNoContent: asNoContent<typeof Gone>;InternalServerErrorNoContent
No-content schema variant for InternalServerError, decoding an empty 500 response into an InternalServerError error value.
Signature
declare const InternalServerErrorNoContent: asNoContent<typeof InternalServerError>;MethodNotAllowedNoContent
No-content schema variant for MethodNotAllowed, decoding an empty 405 response into a MethodNotAllowed error value.
Signature
declare const MethodNotAllowedNoContent: asNoContent<typeof MethodNotAllowed>;NotAcceptableNoContent
No-content schema variant for NotAcceptable, decoding an empty 406 response into a NotAcceptable error value.
Signature
declare const NotAcceptableNoContent: asNoContent<typeof NotAcceptable>;NotFoundNoContent
No-content schema variant for NotFound, decoding an empty 404 response into a NotFound error value.
Signature
declare const NotFoundNoContent: asNoContent<typeof NotFound>;NotImplementedNoContent
No-content schema variant for NotImplemented, decoding an empty 501 response into a NotImplemented error value.
Signature
declare const NotImplementedNoContent: asNoContent<typeof NotImplemented>;RequestTimeoutNoContent
No-content schema variant for RequestTimeout, decoding an empty 408 response into a RequestTimeout error value.
Signature
declare const RequestTimeoutNoContent: asNoContent<typeof RequestTimeout>;UnprocessableEntityNoContent
No-content schema variant for UnprocessableEntity, decoding an empty 422 response into an UnprocessableEntity error value.
Signature
declare const UnprocessableEntityNoContent: asNoContent<typeof UnprocessableEntity>;Type IDs
HttpApiSchemaErrorTypeId
Runtime identifier used to mark and detect HttpApiSchemaError values.
Signature
declare const HttpApiSchemaErrorTypeId: "~effect/httpapi/HttpApiError/HttpApiSchemaError";HttpApiSchemaErrorTypeId type
Type-level identifier used to mark HttpApiSchemaError values.
Signature
type HttpApiSchemaErrorTypeId = "~effect/httpapi/HttpApiError/HttpApiSchemaError";
Built-in HTTP API error for a
400 Bad Requestresponse. When used directly as a server response, it renders as an empty response with status 400.