Remove unused regex and format errors and utils files

pull/425/head
Enrico204 4 years ago committed by Demian
parent ff90c378bb
commit 87a87bd338

@ -2,7 +2,6 @@ package telebot
import (
"fmt"
"regexp"
"strings"
)
@ -50,8 +49,6 @@ func NewAPIError(code int, msgs ...string) *APIError {
return err
}
var errorRx = regexp.MustCompile(`{.+"error_code":(\d+),"description":"(.+)"(?:,"parameters":{"retry_after":(\d+)})?}`)
var (
// General errors
ErrUnauthorized = NewAPIError(401, "Unauthorized")

@ -61,10 +61,10 @@ func wrapError(err error) error {
func extractOk(data []byte) error {
// Parse the error message as JSON
var tgramApiError struct {
Ok bool `json:"ok"`
ErrorCode int `json:"error_code"`
Description string `json:"description"`
Parameters map[string]interface{} `json:"parameters"`
Ok bool `json:"ok"`
ErrorCode int `json:"error_code"`
Description string `json:"description"`
Parameters map[string]interface{} `json:"parameters"`
}
err := json.Unmarshal(data, &tgramApiError)
if err != nil {

Loading…
Cancel
Save