-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #536 from driesvints/fix-matrix-build
Fix matrix build and Laravel 7 support
- Loading branch information
Showing
17 changed files
with
231 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace Livewire; | ||
|
||
use Exception; | ||
use Illuminate\Foundation\Application; | ||
use Illuminate\View\Engines\CompilerEngine as LaravelCompilerEngine; | ||
use Illuminate\View\Engines\PhpEngine; | ||
use Livewire\Exceptions\BypassViewHandler; | ||
use Symfony\Component\HttpKernel\Exception\HttpException; | ||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||
use Throwable; | ||
|
||
if (Application::VERSION === '7.x-dev' || version_compare(Application::VERSION, '7.0', '>=')) { | ||
class CompilerEngine extends LaravelCompilerEngine | ||
{ | ||
// Errors thrown while a view is rendering are caught by the Blade | ||
// compiler and wrapped in an "ErrorException". This makes Livewire errors | ||
// harder to read, AND causes issues like `abort(404)` not actually working. | ||
protected function handleViewException(Throwable $e, $obLevel) | ||
{ | ||
$uses = array_flip(class_uses_recursive($e)); | ||
|
||
if ( | ||
// Don't wrap "abort(404)". | ||
$e instanceof NotFoundHttpException | ||
// Don't wrap "abort(500)". | ||
|| $e instanceof HttpException | ||
// Don't wrap most Livewire exceptions. | ||
|| isset($uses[BypassViewHandler::class]) | ||
) { | ||
// This is because there is no "parent::parent::". | ||
PhpEngine::handleViewException($e, $obLevel); | ||
|
||
return; | ||
} | ||
|
||
parent::handleViewException($e, $obLevel); | ||
} | ||
} | ||
} else { | ||
class CompilerEngine extends LaravelCompilerEngine | ||
{ | ||
// Errors thrown while a view is rendering are caught by the Blade | ||
// compiler and wrapped in an "ErrorException". This makes Livewire errors | ||
// harder to read, AND causes issues like `abort(404)` not actually working. | ||
protected function handleViewException(Exception $e, $obLevel) | ||
{ | ||
$uses = array_flip(class_uses_recursive($e)); | ||
|
||
if ( | ||
// Don't wrap "abort(404)". | ||
$e instanceof NotFoundHttpException | ||
// Don't wrap "abort(500)". | ||
|| $e instanceof HttpException | ||
// Don't wrap most Livewire exceptions. | ||
|| isset($uses[BypassViewHandler::class]) | ||
) { | ||
// This is because there is no "parent::parent::". | ||
PhpEngine::handleViewException($e, $obLevel); | ||
|
||
return; | ||
} | ||
|
||
parent::handleViewException($e, $obLevel); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.