From 10a290b06577f00e88c8788846744822f5ee2384 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Sun, 29 Sep 2024 13:19:44 +0200 Subject: [PATCH] chore(libreoffice): improve HTTP error messages --- pkg/modules/libreoffice/routes.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/modules/libreoffice/routes.go b/pkg/modules/libreoffice/routes.go index 31d22d12..ba8340c6 100644 --- a/pkg/modules/libreoffice/routes.go +++ b/pkg/modules/libreoffice/routes.go @@ -191,14 +191,14 @@ func convertRoute(libreOffice libreofficeapi.Uno, engine gotenberg.PdfEngine) ap if errors.Is(err, libreofficeapi.ErrUnoException) { return api.WrapError( fmt.Errorf("convert to PDF: %w", err), - api.NewSentinelHttpError(http.StatusBadRequest, fmt.Sprintf("LibreOffice failed to process the document: possible causes include malformed page ranges '%s' (nativePageRanges) or the document might not be password-protected, but the exact cause is uncertain", options.PageRanges)), + api.NewSentinelHttpError(http.StatusBadRequest, fmt.Sprintf("LibreOffice failed to process a document: possible causes include malformed page ranges '%s' (nativePageRanges), or, if a password has been provided, it may not be required. In any case, the exact cause is uncertain.", options.PageRanges)), ) } if errors.Is(err, libreofficeapi.ErrRuntimeException) { return api.WrapError( fmt.Errorf("convert to PDF: %w", err), - api.NewSentinelHttpError(http.StatusBadRequest, "LibreOffice failed to process a document: a password may be invalid or required, but the exact cause is uncertain"), + api.NewSentinelHttpError(http.StatusBadRequest, "LibreOffice failed to process a document: a password may be required, or, if one has been given, it is invalid. In any case, the exact cause is uncertain."), ) }