Skip to content

Commit

Permalink
Extension: simplify exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Jan 4, 2024
1 parent fc83426 commit 8f91eab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 0 additions & 8 deletions src/ManifestFileDoesNotExistsException.php

This file was deleted.

8 changes: 4 additions & 4 deletions src/Nette/Extension.php
Expand Up @@ -3,7 +3,7 @@
namespace Contributte\Vite\Nette;

use Contributte\Vite\AssetFilter;
use Contributte\Vite\ManifestFileDoesNotExistsException;
use Contributte\Vite\Exception\LogicalException;
use Contributte\Vite\Service;
use Contributte\Vite\Tracy\VitePanel;
use Nette\DI\CompilerExtension;
Expand Down Expand Up @@ -114,7 +114,7 @@ private function prepareManifestPath(): string
if (!is_file($manifestFile)) {
$newPath = $this->config->wwwDir . DIRECTORY_SEPARATOR . ltrim($manifestFile, '/\\');
if (!is_file($newPath)) {
throw new ManifestFileDoesNotExistsException(sprintf('Found here "%s" or "%s".', $manifestFile, $newPath));
throw new LogicalException(sprintf('Found here "%s" or "%s".', $manifestFile, $newPath));
}

$manifestFile = $newPath;
Expand All @@ -141,9 +141,9 @@ private function automaticSearchManifestFile(): string
}

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

return reset($files);
Expand Down

0 comments on commit 8f91eab

Please sign in to comment.