From 5ff4f3a79b7674af4a495f8294cfc524da74afd3 Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L de Mello" Date: Tue, 25 Feb 2025 15:59:48 -0300 Subject: [PATCH] feat(smalltrip,exceptions): Data field for additional contextual data --- smalltrip/exceptions/exceptions.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/smalltrip/exceptions/exceptions.go b/smalltrip/exceptions/exceptions.go index f8b396d..7d088f1 100644 --- a/smalltrip/exceptions/exceptions.go +++ b/smalltrip/exceptions/exceptions.go @@ -7,11 +7,12 @@ import ( ) type Exception struct { - Status int `json:"status"` // HTTP Status Code - Code string `json:"code"` // Application error code - Message string `json:"message"` // User friendly message - Err error `json:"error,omitempty"` // Go error - Severity Severity `json:"severity"` // Exception level + Status int `json:"status"` // HTTP Status Code + Code string `json:"code"` // Application error code + Message string `json:"message"` // User friendly message + Err error `json:"error,omitempty"` // Go error + Data map[string]any `json:"data,omitempty"` // Additional contextual data + Severity Severity `json:"severity"` // Exception level // Handler to be used. This is normally provided by a middleware via the // request context. Setting this field overrides any provided by the middleware