添加文件: ymt_v3_generate/errors.go
This commit is contained in:
parent
59c76e8b7e
commit
7d5dd449b0
|
|
@ -0,0 +1,14 @@
|
||||||
|
package ymt_v3_generate
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// APIError 表示 API 返回的业务错误
|
||||||
|
type APIError struct {
|
||||||
|
Code int `json:"code"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
Reason string `json:"reason,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *APIError) Error() string {
|
||||||
|
return fmt.Sprintf("API error: code=%d, message=%s, reason=%s", e.Code, e.Message, e.Reason)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue