Skip to content

Commit

Permalink
Merge pull request #339 from nextcloud/enh/noid/improve-logging
Browse files Browse the repository at this point in the history
improve error logging in dockeractionmanager
  • Loading branch information
szaimen authored Mar 16, 2022
2 parents 172ae49 + 8317b30 commit 1fc8f2d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 2 additions & 0 deletions php/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,6 @@
}
});

$errorMiddleware = $app->addErrorMiddleware(true, true, true);

$app->run();
22 changes: 15 additions & 7 deletions php/src/Docker/DockerActionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,18 @@ public function CreateContainer(Container $container) : void {
}

$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
Expand Down Expand Up @@ -344,6 +349,7 @@ private function GetRepoDigestOfContainer(string $containerName) : ?string {

return null;
} catch (\Exception $e) {
error_log('Could not get digest of container ' . $this->BuildApiUrl($containerName) . ' ' . $e->getMessage());
return null;
}
}
Expand All @@ -365,6 +371,7 @@ public function GetCurrentChannel() : string {
apcu_add($cacheKey, $tag);
return $tag;
} catch (\Exception $e) {
error_log('Could not get current channel ' . $e->getMessage());
}

return 'latest';
Expand Down Expand Up @@ -451,6 +458,7 @@ public function DisconnectContainerFromNetwork(Container $container) : void
]
);
} catch (RequestException $e) {
error_log('Could not disconnect container from network ' . $e->getMessage());
}
}

Expand Down

0 comments on commit 1fc8f2d

Please sign in to comment.