Briefle
LearnGlossaryPricing

Briefle words · Code & architecture

Error code

A short, stable, machine-readable label for a specific kind of failure that programs can check, separate from the human-readable message.

Say it to an AI

When POST /v1/bookings fails payment, return a Problem Details (RFC 9457) body: type, title, status and a human detail, plus a stable machine-readable error code (e.g. card_expired), the offending field and the correlation ID. Never a generic 'Something went wrong'.

How an expert would brief the stronger version of “Booking API error”.

See it

Try it as a puzzle →

An API client showing what a travel booking API returns when the payment step fails.

Study A · the weaker one
Study B · the stronger one

Why: B's '"code": "card_expired"' lets the app show a 'use another card' screen; A's only clue is the free-text 'Something went wrong'.

More ways experts use it

  • Add one error-handling middleware for the payments API so every endpoint returns the same error envelope: {"error": {"code", "message", "field?"}} with a stable snake_case error code and the right 4xx status. Route handlers throw typed errors; only the middleware formats responses.

    Payment API errors · Code & architecture

Related words

  • Identifier
  • Intention-revealing name
  • Guard clause
  • Happy path
  • Swallowed exception
  • Structured logging
  • Conventional Commits
  • Atomic commit

Room 1 · Essentials

Learn “Error code” in a five-minute lesson

Start free
AI can build almost anything. The bottleneck is saying what you want.
WordsPricingTermsPrivacyRefundsContact
© 2026 Briefle