errorcore
Capturing Errors

Request Context

Request context answers the basic operational questions around a failure: which route broke, which method hit it, and whether a request identifier can tie the incident back to server logs or traces.

Attach request context as early as possible in the request lifecycle. Good defaults include:

  • request method
  • route or path template
  • request ID
  • selected headers after filtering
  • authenticated actor ID when policy allows it

Keep the captured shape narrow. Context should identify the request, not mirror the full body.

On this page