There is a very simple solution: don’t cast View object to a string.
Don’t: echo View::make('..'); or echo view('..');
Do: echo View::make('..')->render(); or echo view('..')->render();
For PHP version <7.4 By casting view, it uses __toString() method automatically, which cannot throw an exception. If you call render() manually, exceptions are handled normally. This is the case if there is an error in the view – laravel throws an exception.
It’s fixed in PHP >=7.4 you should not encounter this issue: https://wiki.php.net/rfc/tostring_exceptions.
For PHP version <7.4: This actually is a PHP limitation, not Laravels. Read more about this “feature” here: https://bugs.php.net/bug.php?id=53648