diff --git a/exception.go b/exception.go index a9bbe5a..848b42f 100644 --- a/exception.go +++ b/exception.go @@ -8,6 +8,7 @@ package exception import ( + "encoding/json" "errors" "fmt" "runtime" @@ -28,7 +29,13 @@ type Exception struct { } func (e *Exception) Error() string { - return e.Message() + mapData := map[string]any{ + "code": e.Code(), + "msg": e.Message(), + "data": e.Data(), + } + byteData, _ := json.Marshal(mapData) + return string(byteData) } func (e *Exception) GetStack() string {