Add error handler when trying to invoke in ClassLoader
This commit is contained in:
parent
4b7cd6ce6e
commit
776cea7055
@ -3,6 +3,7 @@
|
|||||||
namespace App\Support;
|
namespace App\Support;
|
||||||
|
|
||||||
use Symfony\Component\ClassLoader\ClassMapGenerator;
|
use Symfony\Component\ClassLoader\ClassMapGenerator;
|
||||||
|
use Log;
|
||||||
|
|
||||||
class ClassLoader
|
class ClassLoader
|
||||||
{
|
{
|
||||||
@ -20,7 +21,13 @@ class ClassLoader
|
|||||||
|
|
||||||
$all_classes = array_keys(ClassMapGenerator::createMap($path));
|
$all_classes = array_keys(ClassMapGenerator::createMap($path));
|
||||||
foreach ($all_classes as $cl) {
|
foreach ($all_classes as $cl) {
|
||||||
|
try {
|
||||||
$klass = new $cl;
|
$klass = new $cl;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Error loading class: ' . $e->getMessage());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$classes[] = $klass;
|
$classes[] = $klass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user