Skip to content

HttpError ​

HttpError proporciona constructores tipados para fallas HTTP esperadas.

Constructores ​

ConstructorFirma
BadRequest(message: string) => HttpError
Unauthorized(message: string) => HttpError
Forbidden(message: string) => HttpError
NotFound(message: string) => HttpError
Conflict(message: string) => HttpError
UnprocessableEntity(message: string) => HttpError
InternalServerError(message: string) => HttpError
custom(status: HttpStatus, errorCode: string, message: string) => HttpError
Firmaconst error = HttpError.custom(HttpStatus.TooManyRequests, "rate_limit", "Too many requests");
tyrus
import { HttpError, HttpStatus } from "tyrus:http";

return reply.error(HttpError.NotFound("User not found"));