14 lines
346 B
Go
14 lines
346 B
Go
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)
|
|
} |