diff --git a/tgapi/api.go b/tgapi/api.go index 320eee3..fe8f5b4 100644 --- a/tgapi/api.go +++ b/tgapi/api.go @@ -75,7 +75,7 @@ func (r TelegramRequest[R, P]) DoWithContext(ctx context.Context, api *API) (R, } api.Logger.Debugln("RES", r.method, string(data)) if res.StatusCode != http.StatusOK { - return zero, fmt.Errorf("unexpected status code: %d", res.StatusCode) + return zero, fmt.Errorf("unexpected status code: %d, %s", res.StatusCode, string(data)) } var resp ApiResponse[R] diff --git a/tgapi/uploader_api.go b/tgapi/uploader_api.go index d1aa164..64fe7ca 100644 --- a/tgapi/uploader_api.go +++ b/tgapi/uploader_api.go @@ -108,9 +108,6 @@ func (u UploaderRequest[R, P]) DoWithContext(ctx context.Context, up *Uploader) return zero, err } defer res.Body.Close() - if res.StatusCode != http.StatusOK { - return zero, fmt.Errorf("unexpected status code: %d", res.StatusCode) - } reader := io.LimitReader(res.Body, 10<<20) body, err := io.ReadAll(reader) @@ -118,6 +115,9 @@ func (u UploaderRequest[R, P]) DoWithContext(ctx context.Context, up *Uploader) return zero, err } up.logger.Debugln("UPLOADER RES", u.method, string(body)) + if res.StatusCode != http.StatusOK { + return zero, fmt.Errorf("unexpected status code: %d, %s", res.StatusCode, string(body)) + } var resp ApiResponse[R] err = json.Unmarshal(body, &resp) diff --git a/utils/version.go b/utils/version.go index e5ad682..b3b2723 100644 --- a/utils/version.go +++ b/utils/version.go @@ -1,8 +1,8 @@ package utils const ( - VersionString = "0.6.1" + VersionString = "0.6.2" VersionMajor = 0 VersionMinor = 6 - VersionPatch = 1 + VersionPatch = 2 )