package exceptions import "fmt" type InsufficientDataError struct { Field string Message string } func NewInsufficientDataError(field, msg string) *InsufficientDataError { return &InsufficientDataError{Field: field, Message: msg} } func (e InsufficientDataError) Error() string { return fmt.Sprintf("字段 [%s] 数据不足,%s", e.Field, e.Message) }