3pl/partnerapi/shiip/error.go

23 lines
404 B
Go
Raw Normal View History

2022-12-01 04:18:07 +00:00
package shiip
import (
"fmt"
)
// Error ...
type Error struct {
Code string `json:"code"`
Message string `json:"errorMessage"`
}
// Error ...
func (e Error) Error() string {
return fmt.Sprintf("tnc_err: code %s, messsage %s", e.Code, e.Message)
}
// IsErrExistPartnerCode ...
func IsErrExistPartnerCode(err error) bool {
e, ok := err.(Error)
return ok && e.Code == ErrCodeExistPartnerCode
}