Skip to content

Commit

Permalink
errors: add missed entries to Err
Browse files Browse the repository at this point in the history
  • Loading branch information
demget committed Nov 19, 2023
1 parent 4e31cc6 commit 76f1c0e
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ var (
// Bad request errors
var (
ErrBadButtonData = NewError(400, "Bad Request: BUTTON_DATA_INVALID")
ErrBadUserID = NewError(400, "Bad Request: USER_ID_INVALID")
ErrBadPollOptions = NewError(400, "Bad Request: expected an Array of String as options")
ErrBadURLContent = NewError(400, "Bad Request: failed to get HTTP URL content")
ErrCantEditMessage = NewError(400, "Bad Request: message can't be edited")
Expand Down Expand Up @@ -117,11 +118,10 @@ var (
ErrWrongTypeOfContent = NewError(400, "Bad Request: wrong type of the web page content")
ErrWrongURL = NewError(400, "Bad Request: wrong HTTP URL specified")
ErrForwardMessage = NewError(400, "Bad Request: administrators of the chat restricted message forwarding")
ErrAlreadyParticipant = NewError(400, "Bad Request: USER_ALREADY_PARTICIPANT", "User is already a participant")
ErrChannelsTooMuch = NewError(400, "Bad Request: CHANNELS_TOO_MUCH")
ErrUserChannelsTooMuch = NewError(400, "Bad Request: USER_CHANNELS_TOO_MUCH")
ErrUserAlreadyParticipant = NewError(400, "Bad Request: USER_ALREADY_PARTICIPANT", "User is already a participant")
ErrHideRequesterMissing = NewError(400, "Bad Request: HIDE_REQUESTER_MISSING")
ErrUserIDInvalid = NewError(400, "Bad Request: USER_ID_INVALID")
ErrChannelsTooMuch = NewError(400, "Bad Request: CHANNELS_TOO_MUCH")
ErrChannelsTooMuchUser = NewError(400, "Bad Request: USER_CHANNELS_TOO_MUCH")
)

// Forbidden errors
Expand All @@ -147,6 +147,8 @@ func Err(s string) error {
return ErrInternal
case ErrBadButtonData.ʔ():
return ErrBadButtonData
case ErrBadUserID.ʔ():
return ErrBadUserID
case ErrBadPollOptions.ʔ():
return ErrBadPollOptions
case ErrBadURLContent.ʔ():
Expand Down Expand Up @@ -239,6 +241,14 @@ func Err(s string) error {
return ErrUserIsDeactivated
case ErrForwardMessage.ʔ():
return ErrForwardMessage
case ErrUserAlreadyParticipant.ʔ():
return ErrUserAlreadyParticipant
case ErrHideRequesterMissing.ʔ():
return ErrHideRequesterMissing
case ErrChannelsTooMuch.ʔ():
return ErrChannelsTooMuch
case ErrChannelsTooMuchUser.ʔ():
return ErrChannelsTooMuchUser
default:
return nil
}
Expand Down

0 comments on commit 76f1c0e

Please sign in to comment.