From 5e5cbc79bb8e48f6ed6e6a89ec6b9dda4ec33514 Mon Sep 17 00:00:00 2001 From: Ihor Vereshchynskyi Date: Tue, 6 Aug 2024 16:55:32 +0300 Subject: [PATCH] [11.x] Introduce MixFileNotFoundException for handling missing Mix files (#52400) * Add MixFileNotFoundException for better error handling * Update MixFileNotFoundException.php * Update MixFileNotFoundException.php --------- Co-authored-by: Ihor Vereshchynskyi Co-authored-by: Taylor Otwell --- src/Illuminate/Foundation/Mix.php | 5 ++--- src/Illuminate/Foundation/MixFileNotFoundException.php | 10 ++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 src/Illuminate/Foundation/MixFileNotFoundException.php diff --git a/src/Illuminate/Foundation/Mix.php b/src/Illuminate/Foundation/Mix.php index f06deb956e83..c465247a65b1 100644 --- a/src/Illuminate/Foundation/Mix.php +++ b/src/Illuminate/Foundation/Mix.php @@ -2,7 +2,6 @@ namespace Illuminate\Foundation; -use Exception; use Illuminate\Support\HtmlString; use Illuminate\Support\Str; @@ -15,7 +14,7 @@ class Mix * @param string $manifestDirectory * @return \Illuminate\Support\HtmlString|string * - * @throws \Illuminate\Foundation\MixManifestNotFoundException + * @throws \Illuminate\Foundation\MixManifestNotFoundException|\Illuminate\Foundation\MixFileNotFoundException */ public function __invoke($path, $manifestDirectory = '') { @@ -58,7 +57,7 @@ public function __invoke($path, $manifestDirectory = '') $manifest = $manifests[$manifestPath]; if (! isset($manifest[$path])) { - $exception = new Exception("Unable to locate Mix file: {$path}."); + $exception = new MixFileNotFoundException("Unable to locate Mix file: {$path}."); if (! app('config')->get('app.debug')) { report($exception); diff --git a/src/Illuminate/Foundation/MixFileNotFoundException.php b/src/Illuminate/Foundation/MixFileNotFoundException.php new file mode 100644 index 000000000000..4e0ea741b728 --- /dev/null +++ b/src/Illuminate/Foundation/MixFileNotFoundException.php @@ -0,0 +1,10 @@ +