Skip to content

HttpServerError

12 exports Added in v1.0.0 Source

Error

HttpServerError type

Added in v1.0.0 Source

Signature

type HttpServerError = RequestError | ResponseError | RouteNotFound | ServeError;

RequestError

Added in v1.0.0 Source

Signature

declare class RequestError extends YieldableError<this> & Record<typeof TypeId, typeof TypeId> & {
  readonly _tag: "RequestError";
} & Readonly<{
  readonly cause?: unknown;
  readonly description?: string;
  readonly reason: "Transport" | "Decode";
  readonly request: HttpServerRequest;
}> implements Respondable {
  constructor(args: {
    readonly cause?: unknown;
    readonly description?: string;
    readonly reason: "Transport" | "Decode";
    readonly request: HttpServerRequest;
  });
  message: string;
  methodAndUrl: string;
  [symbol](): HttpServerResponse;
}

Signature

declare class ResponseError extends YieldableError<this> & Record<typeof TypeId, typeof TypeId> & {
  readonly _tag: "ResponseError";
} & Readonly<{
  readonly cause?: unknown;
  readonly description?: string;
  readonly reason: "Decode";
  readonly request: HttpServerRequest;
  readonly response: HttpServerResponse;
}> {
  constructor(args: {
    readonly cause?: unknown;
    readonly description?: string;
    readonly reason: "Decode";
    readonly request: HttpServerRequest;
    readonly response: HttpServerResponse;
  });
  message: string;
  methodAndUrl: string;
  [symbol](): HttpServerResponse;
}

Signature

declare class RouteNotFound extends YieldableError<this> & Record<typeof TypeId, typeof TypeId> & {
  readonly _tag: "RouteNotFound";
} & Readonly<{
  readonly request: HttpServerRequest;
}> {
  constructor(options: {
    request: HttpServerRequest;
  });
  message: string;
  [symbol](): HttpServerResponse;
}

ServeError

Added in v1.0.0 Source

Signature

declare class ServeError extends YieldableError<this> & Record<typeof TypeId, typeof TypeId> & {
  readonly _tag: "ServeError";
} & Readonly<{
  readonly cause: unknown;
}> {
  constructor(args: {
    readonly cause: unknown;
  });
}

Other

Signature

declare const causeResponse: <E>(
  cause: Cause.Cause<E>,
) => Effect.Effect<readonly [ServerResponse.HttpServerResponse, Cause.Cause<E>]>;

Signature

declare const causeResponseStripped: <E>(
  cause: Cause.Cause<E>,
) => readonly [response: ServerResponse.HttpServerResponse, cause: Option.Option<Cause.Cause<E>>];

Signature

declare const clientAbortFiberId: FiberId.FiberId;

exitResponse

Added in v1.0.0 Source

Signature

declare const exitResponse: <E>(
  exit: Exit.Exit<ServerResponse.HttpServerResponse, E>,
) => ServerResponse.HttpServerResponse;

Predicates

Signature

declare const isServerError: (u: unknown) => u is HttpServerError;

Type Id

TypeId

Added in v1.0.0 Source

Signature

declare const TypeId: unique symbol;

TypeId type

Added in v1.0.0 Source

Signature

type TypeId = typeof TypeId;