Merge pull request #276 from orivej/ErrNotStarted

errors: add ErrNotStartedByUser
pull/280/head
demget 4 years ago committed by GitHub
commit 860ac059a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -50,6 +50,7 @@ var errorRx = regexp.MustCompile(`{.+"error_code":(\d+),"description":"(.+)"}`)
var ( var (
// General errors // General errors
ErrUnauthorized = NewAPIError(401, "Unauthorized") ErrUnauthorized = NewAPIError(401, "Unauthorized")
ErrNotStartedByUser = NewAPIError(403, "Forbidden: bot can't initiate conversation with a user")
ErrBlockedByUser = NewAPIError(401, "Forbidden: bot was blocked by the user") ErrBlockedByUser = NewAPIError(401, "Forbidden: bot was blocked by the user")
ErrUserIsDeactivated = NewAPIError(401, "Forbidden: user is deactivated") ErrUserIsDeactivated = NewAPIError(401, "Forbidden: user is deactivated")
ErrNotFound = NewAPIError(404, "Not Found") ErrNotFound = NewAPIError(404, "Not Found")
@ -97,6 +98,8 @@ func ErrByDescription(s string) error {
switch s { switch s {
case ErrUnauthorized.ʔ(): case ErrUnauthorized.ʔ():
return ErrUnauthorized return ErrUnauthorized
case ErrNotStartedByUser.ʔ():
return ErrNotStartedByUser
case ErrNotFound.ʔ(): case ErrNotFound.ʔ():
return ErrNotFound return ErrNotFound
case ErrUserIsDeactivated.ʔ(): case ErrUserIsDeactivated.ʔ():

Loading…
Cancel
Save