com um clique
getting-started
Define custom API errors. Use when throwing errors in an api.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Define custom API errors. Use when throwing errors in an api.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
Use when scanning NestJS providers with DiscoveryService-backed utilities.
Use when working with the @wisemen/nestjs-custom-fields package — developer-defined custom fields in NestJS with TypeORM persistence and runtime validation. Covers registering the CustomFieldDefinition entity, authoring definitions with customFieldDefinition(), storing resolved values via @CustomFieldValueColumn(), exposing them through CustomFieldValueDto / @IsCustomFields(), and validating submissions with CustomFieldDefinitionsRepository + validateCustomFieldValues(). Use this whenever a task involves custom field definitions, CustomFieldValue columns, custom-field DTOs, or tenant-scoped field definitions, even if the package is not named explicitly.
Use when defining Typesense collections, collectors, and search queries in NestJS APIs.
Generate PDFs through API2PDF in NestJS. Use when converting HTML or URLs to PDFs in apis.
Use when storing and validating multilingual text in NestJS apis with TypeORM and class-validator.
Use when configuring NATS messaging, subscribers, or the simple NatsClient in NestJS applications.
| name | getting-started |
| description | Define custom API errors. Use when throwing errors in an api. |
import { NotFoundApiError, ApiErrorCode } from "@wisemen/api-error"
export class UserNotFoundError extends NotFoundApiError {
@ApiErrorCode("user_not_found")
readonly code = "user_not_found"
constructor() {
super("The requested user was not found")
}
}
import { ApiErrorResponse } from "@wisemen/api-error"
...
export class ViewUserDetailController {
...
@ApiErrorResponse(UserNotFoundError)
async findOne(...): Promise<UserDto> {
...
}
}
it("returns 404 for unknown user", async () => {
const response = await request(...).get(...)
expect(response).toHaveApiError(new UserNotFoundError())
})
import { BadRequestApiError, ApiErrorCode, ApiErrorMeta, } from "@wisemen/api-error"
export class InvalidEmailApiErrorMeta {
@ApiProperty({ type: 'string' })
field: string
constructor(field: string) {
this.field = field
}
}
export class InvalidEmailError extends BadRequestApiError {
@ApiErrorCode("invalid_email")
readonly code = "invalid_email"
@ApiErrorMeta()
readonly meta: InvalidEmailApiErrorMeta
constructor(field: string) {
super("The email address is invalid")
this.meta = new InvalidEmailApiErrorMeta(field)
}
}