From 1a62857df70d34c936f40134a9358e2085088e0b Mon Sep 17 00:00:00 2001 From: szaimen Date: Wed, 9 Mar 2022 18:25:03 +0100 Subject: [PATCH 1/2] improve error logging in dockeractionmanager Signed-off-by: szaimen --- php/src/Docker/DockerActionManager.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 342dd544..d9c1ee51 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -281,13 +281,18 @@ class DockerActionManager } $url = $this->BuildApiUrl('containers/create?name=' . $container->GetIdentifier()); - $this->guzzleClient->request( - 'POST', - $url, - [ - 'json' => $requestBody - ] - ); + try { + $this->guzzleClient->request( + 'POST', + $url, + [ + 'json' => $requestBody + ] + ); + } catch (RequestException $e) { + throw $e; + } + } public function PullContainer(Container $container) : void @@ -344,6 +349,7 @@ class DockerActionManager return null; } catch (\Exception $e) { + error_log('Could not get digest of container ' . $this->BuildApiUrl($containerName) . ' ' . $e->getMessage()); return null; } } @@ -365,6 +371,7 @@ class DockerActionManager apcu_add($cacheKey, $tag); return $tag; } catch (\Exception $e) { + error_log('Could not get current channel ' . $e->getMessage()); } return 'latest'; @@ -451,6 +458,7 @@ class DockerActionManager ] ); } catch (RequestException $e) { + error_log('Could not disconnect container from network ' . $e->getMessage()); } } From 8317b306588a0f4fdf9218bdc243ff2938f2d60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 16 Mar 2022 15:29:31 +0100 Subject: [PATCH 2/2] Add error middleware MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- php/public/index.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/php/public/index.php b/php/public/index.php index 97bc0eb1..c5752a79 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -141,4 +141,6 @@ $app->get('/', function (\Psr\Http\Message\RequestInterface $request, \Psr\Http\ } }); +$errorMiddleware = $app->addErrorMiddleware(true, true, true); + $app->run();