mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-16 20:32:13 +01:00
fix(api): do not catch gotenberg.ErrPdfEngineMethodNotSupported as it may hides other errors
This commit is contained in:
@@ -40,10 +40,6 @@ func ParseError(err error) (int, string) {
|
|||||||
return http.StatusTooManyRequests, http.StatusText(http.StatusTooManyRequests)
|
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) {
|
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"
|
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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,11 +38,6 @@ func TestParseError(t *testing.T) {
|
|||||||
expectStatus: http.StatusTooManyRequests,
|
expectStatus: http.StatusTooManyRequests,
|
||||||
expectMessage: http.StatusText(http.StatusTooManyRequests),
|
expectMessage: http.StatusText(http.StatusTooManyRequests),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
err: gotenberg.ErrPdfEngineMethodNotSupported,
|
|
||||||
expectStatus: http.StatusNotImplemented,
|
|
||||||
expectMessage: http.StatusText(http.StatusNotImplemented),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
err: gotenberg.ErrPdfFormatNotSupported,
|
err: gotenberg.ErrPdfFormatNotSupported,
|
||||||
expectStatus: http.StatusBadRequest,
|
expectStatus: http.StatusBadRequest,
|
||||||
|
|||||||
Reference in New Issue
Block a user