Skip to content

Commit

Permalink
errors: implement ErrIs
Browse files Browse the repository at this point in the history
  • Loading branch information
demget committed Nov 22, 2023
1 parent b1cf07b commit 71ac299
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package telebot

import (
"errors"
"fmt"
"strings"
)
Expand Down Expand Up @@ -254,6 +255,11 @@ func Err(s string) error {
}
}

// ErrIs checks if the error with given description matches an error err.
func ErrIs(s string, err error) bool {
return errors.Is(err, Err(s))
}

// wrapError returns new wrapped telebot-related error.
func wrapError(err error) error {
return fmt.Errorf("telebot: %w", err)
Expand Down

0 comments on commit 71ac299

Please sign in to comment.