Skip to content

Problem Details Types

NENE2 returns application/problem+json for all error responses, following RFC 9457. Every error response includes a type URI, title, status, detail, and instance field.

Type catalog

typeHTTP statustitleProduced by
…/not-found404Not FoundRoute not found; Note or Tag with given id not found
…/method-not-allowed405Method Not AllowedWrong HTTP method for a known route; Allow header lists valid methods
…/invalid-json400Invalid JSONRequest body is empty, syntactically invalid, or not a JSON object
…/validation-failed422Validation FailedInvalid request body or missing required fields
…/unauthorized401UnauthorizedMissing or invalid bearer token on a protected endpoint
…/too-many-requests429Too Many RequestsRate limit exceeded (ThrottleMiddleware); includes Retry-After header
…/payload-too-large413Payload Too LargeRequest body exceeds the configured size limit
…/internal-server-error500Internal Server ErrorUnhandled exception; details are not exposed to the client

Base URI prefix: https://nene2.dev/problems/

Example responses

404 Not Found:

json
{
  "type": "https://nene2.dev/problems/not-found",
  "title": "Not Found",
  "status": 404,
  "detail": "The requested resource was not found.",
  "instance": "/examples/notes/99"
}

422 Validation Failed:

json
{
  "type": "https://nene2.dev/problems/validation-failed",
  "title": "Validation Failed",
  "status": 422,
  "detail": "The request contains invalid values.",
  "instance": "/examples/notes",
  "errors": [
    { "field": "title", "message": "Title must not be empty.", "code": "required" }
  ]
}

400 Invalid JSON:

json
{
  "type": "https://nene2.dev/problems/invalid-json",
  "title": "Invalid JSON",
  "status": 400,
  "detail": "Request body must be a JSON object, got array.",
  "instance": "/examples/notes"
}

405 Method Not Allowed:

json
{
  "type": "https://nene2.dev/problems/method-not-allowed",
  "title": "Method Not Allowed",
  "status": 405,
  "detail": "The requested resource does not support this HTTP method.",
  "instance": "/examples/notes"
}

429 Too Many Requests:

json
{
  "type": "https://nene2.dev/problems/too-many-requests",
  "title": "Too Many Requests",
  "status": 429,
  "detail": "Rate limit exceeded. Try again in 42 seconds.",
  "instance": "/examples/notes"
}

Adding a custom type

  1. Create a domain exception class (e.g. ProductNotFoundException).
  2. Implement DomainExceptionHandlerInterface — call ProblemDetailsResponseFactory::create() with your type slug.
  3. Register the handler in RuntimeServiceProvider.

See NoteNotFoundExceptionHandler and TagNotFoundExceptionHandler for concrete examples.

Released under the MIT License.