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

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

Loading…
Cancel
Save