Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteProblemDetailsResponse ¶
func WriteProblemDetailsResponse(w http.ResponseWriter, r *http.Request, code int, payload interface{})
WriteProblemDetailsResponse writes an RFC 9457 Problem Details response
func WriteServiceErrorResponse ¶ added in v0.4.0
func WriteServiceErrorResponse(ctx context.Context, w http.ResponseWriter, r *http.Request, err *errors.ServiceError)
WriteServiceErrorResponse writes err as an RFC 9457 Problem Details response, resolving the trace ID from ctx (via logger.GetRequestID) and using the request path as the problem instance. ctx is taken explicitly rather than derived from r.Context() so callers can still resolve a trace ID when r is nil. Callers are responsible for logging the error themselves beforehand, since the appropriate log level (e.g. Warn vs Info vs Error) varies by caller.
Types ¶
This section is empty.