Skip to content

Commit

Permalink
Enhance log when di reflection manager faild.
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanyanwow committed Nov 2, 2023
1 parent 2f7d7fa commit 159f575
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/di/src/ReflectionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use ReflectionMethod;
use ReflectionProperty;
use Symfony\Component\Finder\Finder;
use Throwable;

use function Hyperf\Support\value;

Expand Down Expand Up @@ -107,7 +108,13 @@ public static function getAllClasses(array $paths): array
continue;
}
$reflectionClasses[$className] = static::reflectClass($className);
} catch (\Throwable) {
} catch (Throwable $e) {
echo sprintf(
"\033[31m%s\033[0m",
'[ERROR] DI Reflection Manager collect failed. ' . PHP_EOL .
"File: {$file->getRealPath()}." . PHP_EOL .
'Exception: ' . $e->getMessage()
) . PHP_EOL;
}
}
return $reflectionClasses;
Expand Down

0 comments on commit 159f575

Please sign in to comment.