From 35464a79564765d02a69daeedde00ea2a5dae56c Mon Sep 17 00:00:00 2001 From: Storm Timmermans Date: Thu, 25 Feb 2021 11:49:02 +0100 Subject: [PATCH] fix(targets): handle 502 as target unavailable (#97) --- targets/emby/api.go | 2 +- targets/plex/api.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/emby/api.go b/targets/emby/api.go index e8ec1ea7..c75ed192 100644 --- a/targets/emby/api.go +++ b/targets/emby/api.go @@ -50,7 +50,7 @@ func (c apiClient) do(req *http.Request) (*http.Response, error) { switch res.StatusCode { case 401: return nil, fmt.Errorf("invalid emby token: %s: %w", res.Status, autoscan.ErrFatal) - case 404, 500, 503, 504: + case 404, 500, 502, 503, 504: return nil, fmt.Errorf("%s: %w", res.Status, autoscan.ErrTargetUnavailable) default: return nil, fmt.Errorf("%s: %w", res.Status, autoscan.ErrFatal) diff --git a/targets/plex/api.go b/targets/plex/api.go index a3b193e6..59a56ea0 100644 --- a/targets/plex/api.go +++ b/targets/plex/api.go @@ -51,7 +51,7 @@ func (c apiClient) do(req *http.Request) (*http.Response, error) { switch res.StatusCode { case 401: return nil, fmt.Errorf("invalid plex token: %s: %w", res.Status, autoscan.ErrFatal) - case 404, 500, 503, 504: + case 404, 500, 502, 503, 504: return nil, fmt.Errorf("%s: %w", res.Status, autoscan.ErrTargetUnavailable) default: return nil, fmt.Errorf("%s: %w", res.Status, autoscan.ErrFatal)