better invidious error handling
Bi-Rabittoh andronacomarco@gmail.com
Sun, 18 Feb 2024 13:15:14 +0100
1 files changed,
5 insertions(+),
4 deletions(-)
jump to
M
invidious/api.go
→
invidious/api.go
@@ -26,12 +26,13 @@ return nil, http.StatusInternalServerError
} defer resp.Body.Close() + if resp.StatusCode == http.StatusNotFound { + return nil, http.StatusNotFound + } + if resp.StatusCode != http.StatusOK { logger.Warn("Invidious gave the following status code: ", resp.StatusCode) - if resp.StatusCode == http.StatusForbidden { - return nil, http.StatusInternalServerError - } - return nil, http.StatusNotFound + return nil, resp.StatusCode } body, err := io.ReadAll(resp.Body)