升级exception, 简化逻辑 #1

Merged
zhangdeman merged 3 commits from feature/upgrade_exception into master 2025-05-10 19:37:46 +08:00
1718c9c8ad 优化Error实现
白茶清欢
2025-05-10 19:37:27 +08:00
Commit 3 of 3
Show all commits
+8 -1
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 {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.