fix: Add exceptions.

This commit is contained in:
Pol Dellaiera 2021-08-17 16:12:35 +02:00 committed by Marc Ducobu
parent 25fb89f42c
commit 672285d28e

View File

@ -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