- try to append shop info in err msg when ebai api failed.
This commit is contained in:
@@ -7,15 +7,15 @@ import (
|
||||
|
||||
type ErrorWithCode struct {
|
||||
level int
|
||||
str string
|
||||
errMsg string
|
||||
code string
|
||||
intCode int
|
||||
}
|
||||
|
||||
func NewErrorCode(err, code string, level ...int) *ErrorWithCode {
|
||||
func NewErrorCode(errMsg, code string, level ...int) *ErrorWithCode {
|
||||
retVal := &ErrorWithCode{
|
||||
str: err,
|
||||
code: code,
|
||||
errMsg: errMsg,
|
||||
code: code,
|
||||
}
|
||||
retVal.intCode, _ = strconv.Atoi(code)
|
||||
if len(level) > 0 {
|
||||
@@ -25,12 +25,12 @@ func NewErrorCode(err, code string, level ...int) *ErrorWithCode {
|
||||
return retVal
|
||||
}
|
||||
|
||||
func NewErrorIntCode(err string, code int, level ...int) *ErrorWithCode {
|
||||
return NewErrorCode(err, Int2Str(code), level...)
|
||||
func NewErrorIntCode(errMsg string, code int, level ...int) *ErrorWithCode {
|
||||
return NewErrorCode(errMsg, Int2Str(code), level...)
|
||||
}
|
||||
|
||||
func (e *ErrorWithCode) Error() string {
|
||||
return fmt.Sprintf("%s level:%d, code:%s", e.str, e.level, e.code)
|
||||
return fmt.Sprintf("%s level:%d, code:%s", e.errMsg, e.level, e.code)
|
||||
}
|
||||
|
||||
func (e *ErrorWithCode) String() string {
|
||||
@@ -48,3 +48,7 @@ func (e *ErrorWithCode) Code() string {
|
||||
func (e *ErrorWithCode) IntCode() int {
|
||||
return e.intCode
|
||||
}
|
||||
|
||||
func (e *ErrorWithCode) ErrMsg() string {
|
||||
return e.errMsg
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user