Files
tyapi-server/internal/infrastructure/external/muzi/muzi_errors.go

26 lines
529 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package muzi
import "fmt"
// MuziError 木子数据业务错误
type MuziError struct {
Code int
Message string
}
// Error implements error interface.
func (e *MuziError) Error() string {
return fmt.Sprintf("木子数据返回错误,代码: %d信息: %s", e.Code, e.Message)
}
// NewMuziError 根据错误码创建业务错误
func NewMuziError(code int, message string) *MuziError {
if message == "" {
message = "木子数据返回未知错误"
}
return &MuziError{
Code: code,
Message: message,
}
}