From 844bbc5c9701ef4d25b1531b4355626bf0c6b1cb Mon Sep 17 00:00:00 2001 From: Enrico204 Date: Sun, 15 Nov 2020 17:43:31 +0100 Subject: [PATCH] Remove unused regex and format errors and utils files --- errors.go | 3 --- util.go | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/errors.go b/errors.go index 2d6f97f..ef4e4bf 100644 --- a/errors.go +++ b/errors.go @@ -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") diff --git a/util.go b/util.go index ee04d70..003c9a9 100644 --- a/util.go +++ b/util.go @@ -52,10 +52,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 {