Skip to content

Commit 6afe125

Browse files
authored
Merge pull request #50227 from nextcloud/fix/convert-log
fix: Log exceptions that happen during file conversion
2 parents 326120a + fc9af34 commit 6afe125

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apps/files/lib/Controller/ConversionApiController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use OCP\Files\IRootFolder;
2525
use OCP\IL10N;
2626
use OCP\IRequest;
27+
use function OCP\Log\logger;
2728

2829
class ConversionApiController extends OCSController {
2930
public function __construct(
@@ -80,7 +81,8 @@ public function convert(int $fileId, string $targetMimeType, ?string $destinatio
8081
try {
8182
$convertedFile = $this->fileConversionManager->convert($file, $targetMimeType, $destination);
8283
} catch (\Exception $e) {
83-
throw new OCSException($e->getMessage());
84+
logger('files')->error($e->getMessage(), ['exception' => $e]);
85+
throw new OCSException($this->l10n->t('The file could not be converted.'));
8486
}
8587

8688
$convertedFileRelativePath = $userFolder->getRelativePath($convertedFile);

0 commit comments

Comments
 (0)