Replace bad file type error with constant
parent
99262cf76c
commit
6c84cd1fbb
2
bot.go
2
bot.go
|
@ -146,7 +146,7 @@ func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldna
|
||||||
|
|
||||||
ms.WriteReader(fieldname, f.Name, int64(len(data)), buf)
|
ms.WriteReader(fieldname, f.Name, int64(len(data)), buf)
|
||||||
default:
|
default:
|
||||||
return APIResponse{}, errors.New("bad file type")
|
return APIResponse{}, errors.New(ErrBadFileType)
|
||||||
}
|
}
|
||||||
|
|
||||||
method := fmt.Sprintf(APIEndpoint, bot.Token, endpoint)
|
method := fmt.Sprintf(APIEndpoint, bot.Token, endpoint)
|
||||||
|
|
|
@ -39,6 +39,12 @@ const (
|
||||||
ModeMarkdown = "Markdown"
|
ModeMarkdown = "Markdown"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Library errors
|
||||||
|
const (
|
||||||
|
// ErrBadFileType happens when you pass an unknown type
|
||||||
|
ErrBadFileType = "bad file type"
|
||||||
|
)
|
||||||
|
|
||||||
// Chattable is any config type that can be sent.
|
// Chattable is any config type that can be sent.
|
||||||
type Chattable interface {
|
type Chattable interface {
|
||||||
values() (url.Values, error)
|
values() (url.Values, error)
|
||||||
|
|
Loading…
Reference in New Issue