fix: Log exceptions that happen during file conversion

Signed-off-by: Julius Knorr <jus@bitgrid.net>
This commit is contained in:
Julius Knorr 2025-01-17 12:06:36 +01:00
parent 326120a7f7
commit fc9af34799
No known key found for this signature in database
GPG key ID: 4C614C6ED2CDE6DF

View file

@ -24,6 +24,7 @@ use OCP\Files\File;
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 @@ class ConversionApiController extends OCSController {
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);