Add ManifestDoesNotExistException and Solution (#4455)
Co-authored-by: Matthew Penner <matthew@pterodactyl.io>
This commit is contained in:
parent
b1abae8106
commit
16c2b606b4
3 changed files with 47 additions and 1 deletions
15
app/Exceptions/ManifestDoesNotExistException.php
Normal file
15
app/Exceptions/ManifestDoesNotExistException.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Spatie\Ignition\Contracts\Solution;
|
||||
use Spatie\Ignition\Contracts\ProvidesSolution;
|
||||
|
||||
class ManifestDoesNotExistException extends Exception implements ProvidesSolution
|
||||
{
|
||||
public function getSolution(): Solution
|
||||
{
|
||||
return new Solutions\ManifestDoesNotExistSolution();
|
||||
}
|
||||
}
|
25
app/Exceptions/Solutions/ManifestDoesNotExistSolution.php
Normal file
25
app/Exceptions/Solutions/ManifestDoesNotExistSolution.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Exceptions\Solutions;
|
||||
|
||||
use Spatie\Ignition\Contracts\Solution;
|
||||
|
||||
class ManifestDoesNotExistSolution implements Solution
|
||||
{
|
||||
public function getSolutionTitle(): string
|
||||
{
|
||||
return "The manifest.json file hasn't been generated yet";
|
||||
}
|
||||
|
||||
public function getSolutionDescription(): string
|
||||
{
|
||||
return 'Run yarn run build:production to build the frontend first.';
|
||||
}
|
||||
|
||||
public function getDocumentationLinks(): array
|
||||
{
|
||||
return [
|
||||
'Docs' => 'https://github.com/pterodactyl/panel/blob/develop/package.json',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ namespace Pterodactyl\Services\Helpers;
|
|||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Filesystem\FilesystemManager;
|
||||
use Illuminate\Contracts\Filesystem\Filesystem;
|
||||
use Pterodactyl\Exceptions\ManifestDoesNotExistException;
|
||||
|
||||
class AssetHashService
|
||||
{
|
||||
|
@ -106,6 +107,11 @@ class AssetHashService
|
|||
);
|
||||
}
|
||||
|
||||
return static::$manifest;
|
||||
$manifest = static::$manifest;
|
||||
if ($manifest === null) {
|
||||
throw new ManifestDoesNotExistException();
|
||||
}
|
||||
|
||||
return $manifest;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue