Skip to content

Commit 70aafe4

Browse files
author
Syfaro
committed
Replace bad file type error with constant
1 parent 785d032 commit 70aafe4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

bot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldna
146146

147147
ms.WriteReader(fieldname, f.Name, int64(len(data)), buf)
148148
default:
149-
return APIResponse{}, errors.New("bad file type")
149+
return APIResponse{}, errors.New(ErrBadFileType)
150150
}
151151

152152
method := fmt.Sprintf(APIEndpoint, bot.Token, endpoint)

configs.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ const (
3939
ModeMarkdown = "Markdown"
4040
)
4141

42+
// Library errors
43+
const (
44+
// ErrBadFileType happens when you pass an unknown type
45+
ErrBadFileType = "bad file type"
46+
)
47+
4248
// Chattable is any config type that can be sent.
4349
type Chattable interface {
4450
values() (url.Values, error)

0 commit comments

Comments
 (0)