From 6c84cd1fbbb95d6d1286150cd682bb7b8c0cb2be Mon Sep 17 00:00:00 2001 From: Syfaro Date: Sun, 3 Jan 2016 22:49:58 -0600 Subject: [PATCH] Replace bad file type error with constant --- bot.go | 2 +- configs.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bot.go b/bot.go index eb5a20e..eeb8127 100644 --- a/bot.go +++ b/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) default: - return APIResponse{}, errors.New("bad file type") + return APIResponse{}, errors.New(ErrBadFileType) } method := fmt.Sprintf(APIEndpoint, bot.Token, endpoint) diff --git a/configs.go b/configs.go index 4150842..d1db4ac 100644 --- a/configs.go +++ b/configs.go @@ -39,6 +39,12 @@ const ( 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. type Chattable interface { values() (url.Values, error)