From 672285d28eebeeed49f0eeaa71bdcb9967453cab Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 17 Aug 2021 16:12:35 +0200 Subject: [PATCH] fix: Add exceptions. --- src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php index 938f62577..d099732ef 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php @@ -51,10 +51,15 @@ final class ChillWopi implements WopiInterface RequestInterface $request ): ResponseInterface { $storedObject = $this->storedObjectRepository->findOneBy(['filename' => $fileId]); + + if (null === $storedObject) { + throw new Exception(sprintf('Unable to find object named %s', $fileId)); + } + $mimeType = $storedObject->getType(); if (false !== current($this->wopiDiscovery->discoverMimeType($mimeType))) { - // TODO Exception. + throw new Exception(sprintf('Unable to find mime type %s', $mimeType)); } return $this