Skip to content

Commit 8f91eab

Browse files
committed
Extension: simplify exceptions
1 parent fc83426 commit 8f91eab

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

src/ManifestFileDoesNotExistsException.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/Nette/Extension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Contributte\Vite\Nette;
44

55
use Contributte\Vite\AssetFilter;
6-
use Contributte\Vite\ManifestFileDoesNotExistsException;
6+
use Contributte\Vite\Exception\LogicalException;
77
use Contributte\Vite\Service;
88
use Contributte\Vite\Tracy\VitePanel;
99
use Nette\DI\CompilerExtension;
@@ -114,7 +114,7 @@ private function prepareManifestPath(): string
114114
if (!is_file($manifestFile)) {
115115
$newPath = $this->config->wwwDir . DIRECTORY_SEPARATOR . ltrim($manifestFile, '/\\');
116116
if (!is_file($newPath)) {
117-
throw new ManifestFileDoesNotExistsException(sprintf('Found here "%s" or "%s".', $manifestFile, $newPath));
117+
throw new LogicalException(sprintf('Found here "%s" or "%s".', $manifestFile, $newPath));
118118
}
119119

120120
$manifestFile = $newPath;
@@ -141,9 +141,9 @@ private function automaticSearchManifestFile(): string
141141
}
142142

143143
if ($files === []) {
144-
throw new ManifestFileDoesNotExistsException(sprintf('Define path to manifest.json, because automatic search found nothing in "%s".', $this->config->wwwDir));
144+
throw new LogicalException(sprintf('Define path to manifest.json, because automatic search found nothing in "%s".', $this->config->wwwDir));
145145
} elseif (count($files) > 1) {
146-
throw new ManifestFileDoesNotExistsException(sprintf('Define path to manifest.json, because automatic search found many manifest.json files %s.', implode(', ', $files)));
146+
throw new LogicalException(sprintf('Define path to manifest.json, because automatic search found many manifest.json files %s.', implode(', ', $files)));
147147
}
148148

149149
return reset($files);

0 commit comments

Comments
 (0)