From 0f8bbead66a00ac5cff953b8a87ac43c13a1bc1e Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Mon, 4 Mar 2024 11:17:36 +0100 Subject: [PATCH] fix(api): do not catch gotenberg.ErrPdfEngineMethodNotSupported as it may hides other errors --- pkg/modules/api/middlewares.go | 4 ---- pkg/modules/api/middlewares_test.go | 5 ----- 2 files changed, 9 deletions(-) diff --git a/pkg/modules/api/middlewares.go b/pkg/modules/api/middlewares.go index d40c1432..3854e8bc 100644 --- a/pkg/modules/api/middlewares.go +++ b/pkg/modules/api/middlewares.go @@ -40,10 +40,6 @@ func ParseError(err error) (int, string) { return http.StatusTooManyRequests, http.StatusText(http.StatusTooManyRequests) } - if errors.Is(err, gotenberg.ErrPdfEngineMethodNotSupported) { - return http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented) - } - if errors.Is(err, gotenberg.ErrPdfFormatNotSupported) { return http.StatusBadRequest, "At least one PDF engine cannot process the requested PDF format, while others may have failed to convert due to different issues" } diff --git a/pkg/modules/api/middlewares_test.go b/pkg/modules/api/middlewares_test.go index e921f454..7fa5a1c1 100644 --- a/pkg/modules/api/middlewares_test.go +++ b/pkg/modules/api/middlewares_test.go @@ -38,11 +38,6 @@ func TestParseError(t *testing.T) { expectStatus: http.StatusTooManyRequests, expectMessage: http.StatusText(http.StatusTooManyRequests), }, - { - err: gotenberg.ErrPdfEngineMethodNotSupported, - expectStatus: http.StatusNotImplemented, - expectMessage: http.StatusText(http.StatusNotImplemented), - }, { err: gotenberg.ErrPdfFormatNotSupported, expectStatus: http.StatusBadRequest,