@@ -37,9 +37,17 @@ public function action($after, $projectId, Database $dbForConsole, callable $get
3737 $ startTime = microtime (true );
3838
3939 if (!empty ($ projectId )) {
40- $ project = $ dbForConsole ->getDocument ('projects ' , $ projectId );
41- $ dbForProject = call_user_func ($ getProjectDB , $ project );
42- $ this ->recreateRepositories ($ dbForConsole , $ dbForProject , $ project );
40+ try {
41+ $ project = $ dbForConsole ->getDocument ('projects ' , $ projectId );
42+ $ dbForProject = call_user_func ($ getProjectDB , $ project );
43+ $ this ->recreateRepositories ($ dbForConsole , $ dbForProject , $ project );
44+ } catch (\Throwable $ th ) {
45+ Console::error ("Unexpected error occured with Project ID {$ projectId }" );
46+ Console::error ('[Error] Type: ' . get_class ($ th ));
47+ Console::error ('[Error] Message: ' . $ th ->getMessage ());
48+ Console::error ('[Error] File: ' . $ th ->getFile ());
49+ Console::error ('[Error] Line: ' . $ th ->getLine ());
50+ }
4351 } else {
4452 $ queries = [];
4553 if (!empty ($ after )) {
@@ -50,8 +58,18 @@ public function action($after, $projectId, Database $dbForConsole, callable $get
5058 Console::info ("Iterating all projects " );
5159 }
5260 $ this ->foreachDocument ($ dbForConsole , 'projects ' , $ queries , function (Document $ project ) use ($ getProjectDB , $ dbForConsole ) {
53- $ dbForProject = call_user_func ($ getProjectDB , $ project );
54- $ this ->recreateRepositories ($ dbForConsole , $ dbForProject , $ project );
61+ $ projectId = $ project ->getId ();
62+
63+ try {
64+ $ dbForProject = call_user_func ($ getProjectDB , $ project );
65+ $ this ->recreateRepositories ($ dbForConsole , $ dbForProject , $ project );
66+ } catch (\Throwable $ th ) {
67+ Console::error ("Unexpected error occured with Project ID {$ projectId }" );
68+ Console::error ('[Error] Type: ' . get_class ($ th ));
69+ Console::error ('[Error] Message: ' . $ th ->getMessage ());
70+ Console::error ('[Error] File: ' . $ th ->getFile ());
71+ Console::error ('[Error] Line: ' . $ th ->getLine ());
72+ }
5573 });
5674 }
5775
0 commit comments