File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
packages/console/src/Commands Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,12 @@ private function writeFormattedInsights(): void
4949
5050 $ this ->console ->header ($ provider ->name );
5151
52- foreach ($ provider ->getInsights () as $ key => $ value ) {
53- $ this ->console ->keyValue ($ key , $ this ->formatInsight ($ value ));
52+ try {
53+ foreach ($ provider ->getInsights () as $ key => $ value ) {
54+ $ this ->console ->keyValue ($ key , $ this ->formatInsight ($ value ));
55+ }
56+ } catch (\Throwable $ th ) {
57+ $ this ->console ->error ('Failed to get insights: ' . $ th ->getMessage ());
5458 }
5559 }
5660 }
@@ -63,10 +67,13 @@ private function writeInsightsAsJson(): void
6367 /** @var InsightsProvider $provider */
6468 $ provider = $ this ->container ->get ($ class );
6569
66- $ json [Str \to_snake_case ($ provider ->name )] = Arr \map_with_keys (
67- array: $ provider ->getInsights (),
68- map: fn (mixed $ value , string $ key ) => yield Str \to_snake_case ($ key ) => $ this ->rawInsight ($ value ),
69- );
70+ try {
71+ $ json [Str \to_snake_case ($ provider ->name )] = Arr \map_with_keys (
72+ array: $ provider ->getInsights (),
73+ map: fn (mixed $ value , string $ key ) => yield Str \to_snake_case ($ key ) => $ this ->rawInsight ($ value ),
74+ );
75+ } catch (\Throwable ) {
76+ }
7077 }
7178
7279 $ this ->console ->writeRaw (Json \encode ($ json ));
You can’t perform that action at this time.
0 commit comments