@@ -46,14 +46,23 @@ func WithCode[T codeType](err error, businessCode T, options ...Option) error {
option(ret)
}
- if err == nil {
- return &withStack{
- error: ret,
- stack: callers(),
- }
+ if _, ok := err.(*fundamental); ok {
+ return ret
+ }
+ if _, ok := err.(*withCode); ok {
+ if _, ok := err.(*withMessage); ok {
+ if _, ok := err.(*withStack); ok {
- return ret
+ return &withStack{
+ error: ret,
+ stack: callers(),
// UmWrap 获取包装过的error