File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1919namespace OpenConext \MonitorBundle \Controller ;
2020
2121use OpenConext \MonitorBundle \HealthCheck \HealthCheckChain ;
22+ use OpenConext \MonitorBundle \Value \HealthReport ;
2223use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
2324use Symfony \Component \HttpFoundation \JsonResponse ;
2425use Symfony \Component \Routing \Attribute \Route ;
26+ use Throwable ;
2527
2628/**
2729 * Display the health state of the application.
@@ -40,8 +42,11 @@ public function __construct(
4042 #[Route('/internal/health ' , name: 'monitor.internal_health ' , methods: ['GET ' ])]
4143 public function __invoke (): JsonResponse
4244 {
43- $ statusResponse = $ this ->healthChecker ->check ();
44-
45+ try {
46+ $ statusResponse = $ this ->healthChecker ->check ();
47+ } catch (Throwable $ exception ) {
48+ $ statusResponse = HealthReport::buildStatusDown ($ exception ->getMessage ());
49+ }
4550 return $ this ->json ($ statusResponse , $ statusResponse ->getStatusCode ());
4651 }
4752}
You can’t perform that action at this time.
0 commit comments