升级exception, 简化逻辑 #1

Merged
zhangdeman merged 3 commits from feature/upgrade_exception into master 2025-05-10 19:37:46 +08:00
Showing only changes of commit 1718c9c8ad - Show all commits

View File

@ -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 {