From 4741cf988a32e3c14efae2049a89cdee492f1864 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 --- exceptions/exceptions.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/exceptions/exceptions.go b/exceptions/exceptions.go index f8b396d..7d088f1 100644 --- a/exceptions/exceptions.go +++ b/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