HttpError
HttpError fornece construtores tipados para falhas HTTP esperadas.
Construtores
| Construtor | Assinatura |
|---|---|
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 |
Assinatura
const 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"));