Google Sign-In Required

Use your company Google account to access the BetterFleet private content.

Back to private home

BetterFleet Support Private
Skip to content
BetterFleet Dev Wiki
0029 - Adopt RFC 9457 for HTTP Error Responses
Initializing search
    bf-dev
    • Home
    • Product Capabilities
    • Process
    • Current Work
    • System Design
    • Software Reference
    • Operations
    bf-dev
    • Home
      • Overview
      • Manage
      • Overview
      • Product Engineering Workflow
      • Product Engineering Delivery
      • Product Engineering Workflow in Linear
        • GitLab Feature Flags
        • In-App Docs Authoring
        • Release Notes
      • Templates
      • Publishing
      • Workflow Companions
      • Overview
      • Active Artifacts
      • Backlog Artifacts
      • Archived Artifacts
      • Overview
      • Microgrid
      • OSCP
        • Challenge
        • Specification
        • Spec
        • Architecture
        • Overview
        • Script Runtime Model
        • Compose Profiles and Modes
        • Repo Topology
        • CI and Release Integration
        • Overview
        • Internal Application Diagrams
          • Overview
          • Web Model
          • Core Model
        • Service Interaction Flows
        • Data and State
          • Index
          • bf-manage-web
          • bf-manage-core
          • bf-manage-connect
          • bf-manage-sitepwrmon
          • bf-manage-incidents
          • bf-telematics
          • bf-depot-sim
          • bf-manage-roaming
          • bf-support-microsite
          • bf-digital-twin
          • bf-schedule-creator
        • Overview
        • Internal Application Diagrams
        • Migration and Flags
        • Simulation Request Lifecycle
          • Index
          • bf-bnl-ui
          • bf-bnl-settings
          • bf-bnl-schedule-analysis-compute
          • bf-route-modelling
          • bf-schedule-creator
          • bf-digital-twin
        • Overview
        • Secrets and Env Strategy
        • Vendors and Local Dependencies
        • ADRs
        • Service Matrix
        • Cloud Dependencies
        • Ports and URLs
      • Onboarding
      • Daily Operations Runbook
        • Overview
        • Staging Hotfix Release
        • Production Hotfix Release
        • Terraform Plan Dry Runs
      • Troubleshooting
      • Testing Guide
    • Status
    • Context
    • Decision
    • Consequences

    0029 - Adopt RFC 9457 for HTTP Error Responses¶

    Status¶

    Proposed

    Context¶

    Our web application exposes a backend HTTP API that is consumed exclusively by our own frontend. Error responses today (or in the naïve approach) could be defined ad hoc (e.g., { error: "message" } or { code, message }), which is simple in the short term but tends to diverge over time as new teams, features, and error types are introduced. This leads to inconsistent error payloads, custom parsing logic, and additional documentation and maintenance overhead. RFC 9457 ("Problem Details for HTTP APIs") defines a standard JSON (and XML) structure for machine-readable error information in HTTP responses, using the application/problem+json media type. It provides a canonical top-level schema with fields such as type, title, status, detail, and instance, plus arbitrary extension members for domain-specific data. The stated goal is to avoid re-inventing error formats for each API while still supporting application-specific semantics. Although our current API is only used by a single frontend, we value standardization, convention over configuration, and minimizing boilerplate and custom code. We also anticipate increased use of AI tools, code generation, and static analysis that benefit from predictable, documented structures.

    Decision¶

    We will adopt RFC 9457 "Problem Details for HTTP APIs" as the standard envelope for all non-2xx HTTP error responses in our web application, serialized as application/problem+json. Concretely: * Every error response will return a JSON object conforming to RFC 9457's "problem details" model, with at least type, title, status, and detail where applicable. * We will define and document a small set of application-specific "problem types" as URIs under our domain (e.g., https://ourapp.example/problems/validation-error) for recurring domain errors. * Additional machine-readable metadata may be added via extension members when needed (e.g., field_errors, correlation IDs, business codes). * Domain error handling inside the codebase should map naturally onto problem details rather than inventing ad hoc serializers per endpoint.

    Consequences¶

    Positive: * Error handling becomes standardized, documented, and easier to reason about. * Frontend and future clients can rely on a stable schema for parsing and presenting errors. * We reduce custom code, documentation drift, and integration ambiguity. * AI-assisted tooling and generated clients benefit from a known error contract.

    Negative / Trade-offs: * Some initial effort is required to define problem types and refactor existing endpoints. * The structure may feel heavier than minimal ad hoc payloads for very simple internal APIs, but this cost is acceptable in exchange for consistency.

    Made with Material for MkDocs