errors: implement ErrIs

pull/625/head^2
Demian 6 months ago
parent b1cf07b13d
commit 71ac2995cc

@ -1,6 +1,7 @@
package telebot
import (
"errors"
"fmt"
"strings"
)
@ -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)

Loading…
Cancel
Save