2024-11-13 04:03:14 +00:00
|
|
|
package errs
|
|
|
|
|
2024-11-13 04:06:40 +00:00
|
|
|
import (
|
|
|
|
"code.30cm.net/digimon/library-go/errs/code"
|
|
|
|
"fmt"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2024-11-13 04:03:14 +00:00
|
|
|
type ErrorCode uint32
|
|
|
|
|
|
|
|
func (e ErrorCode) ToUint32() uint32 {
|
|
|
|
return uint32(e)
|
|
|
|
}
|
2024-11-13 04:06:40 +00:00
|
|
|
|
|
|
|
func ThirdPartyError(scope uint32, ec ErrorCode, s ...string) *LibError {
|
|
|
|
return NewError(scope, code.ThirdParty, ec.ToUint32(), fmt.Sprintf("thirty error: %s", strings.Join(s, " ")))
|
|
|
|
}
|
|
|
|
|
|
|
|
func ThirdPartyErrorL(scope uint32, ec ErrorCode,
|
|
|
|
l logx.Logger, filed []logx.LogField, s ...string) *LibError {
|
|
|
|
e := ThirdPartyError(scope, ec, s...)
|
|
|
|
l.WithCallerSkip(1).WithFields(filed...).Error(e.Error())
|
|
|
|
|
|
|
|
return e
|
|
|
|
}
|