agentsclimarketplace

Error handling

Skill undp/carbon-footprint-program/.claude/skills/error-handling

Error handling across API and web. Use when throwing, shaping, or translating errors — the shared error classes, error-response schema, Prisma error helpers, and the frontend error-message mapping.From its SKILL.md

Install
npx -y skills add undp/carbon-footprint-program --skill error-handling

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

1.3 KB, as published. Nobody here has run it

Error Handling

  • API errors: throw custom error classes from apps/api/src/errors/ (e.g., DataIntegrityError, EmptyResourceError, DatabaseUniqueConstraintViolationError). Services can throw these at any point — Fastify's error handler plugin catches them automatically and normalizes them into a standard response. Always reuse the existing error classes instead of defining new feature-specific ones; the shared set covers the common cases (not found, unique constraint violation, data integrity, empty resource, config error).
  • Error response schema: use ApiErrorResponseSchema from apps/api/src/commonSchemas/errors.ts for error responses in route schemas (e.g., response: { 404: ApiErrorResponseSchema }).
  • Prisma errors: use helpers like extractP2002Fields() from apps/api/src/errors/ to handle unique constraint violations with meaningful messages.
  • Frontend error messages: getApiErrorMessage() in apps/web/src/utils/getApiErrorMessage.ts maps API error codes to user-facing Spanish messages.

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.