From fc9af3479976c9fa9ac5059233aa799b2ef18bd7 Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Fri, 17 Jan 2025 12:06:36 +0100 Subject: [PATCH] fix: Log exceptions that happen during file conversion Signed-off-by: Julius Knorr --- apps/files/lib/Controller/ConversionApiController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/files/lib/Controller/ConversionApiController.php b/apps/files/lib/Controller/ConversionApiController.php index 1a1b7da17871b..40ea45451ad09 100644 --- a/apps/files/lib/Controller/ConversionApiController.php +++ b/apps/files/lib/Controller/ConversionApiController.php @@ -24,6 +24,7 @@ use OCP\Files\IRootFolder; use OCP\IL10N; use OCP\IRequest; +use function OCP\Log\logger; class ConversionApiController extends OCSController { public function __construct( @@ -80,7 +81,8 @@ public function convert(int $fileId, string $targetMimeType, ?string $destinatio try { $convertedFile = $this->fileConversionManager->convert($file, $targetMimeType, $destination); } catch (\Exception $e) { - throw new OCSException($e->getMessage()); + logger('files')->error($e->getMessage(), ['exception' => $e]); + throw new OCSException($this->l10n->t('The file could not be converted.')); } $convertedFileRelativePath = $userFolder->getRelativePath($convertedFile);