From 7b7c32d9abdfc4cfd35857c9b0003edcf3af83a5 Mon Sep 17 00:00:00 2001 From: Joe Monk Date: Thu, 4 Sep 2025 23:14:55 +0100 Subject: [PATCH] Throw a load of logging in as well --- src/server/api/routers/docker.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server/api/routers/docker.ts b/src/server/api/routers/docker.ts index 942ba3e..1ca1386 100644 --- a/src/server/api/routers/docker.ts +++ b/src/server/api/routers/docker.ts @@ -39,11 +39,12 @@ export const dockerRouter = createTRPCRouter({ const containers = await getContainers(docker); // All this data should be local/from the local docker socket/api - let dockerInfo = sift( + const dockerInfo = sift( await Promise.all( containers.map(async (container) => { try { if (!container.Id) { + console.error("No container id could be found"); throw new Error("No container id could be found"); } @@ -80,6 +81,7 @@ export const dockerRouter = createTRPCRouter({ ); if (dockerInfo.length === 0) { + console.error("No docker containers could be found, check logs for more information"); throw new TRPCError({ code: "NOT_FOUND", message: "No docker containers could be found, check logs for more information", @@ -104,9 +106,11 @@ async function getImageData(docker: Docker, container: Docker.ContainerInfo) { const hash = digest?.split("@")?.[1]?.split(":")?.[1]; if (!name) { + console.error("Container image name could not be found"); throw new Error("Container image name could not be found"); } if (!hash) { + console.error("No image hash could be found"); throw new Error("No image hash could be found"); } @@ -125,6 +129,7 @@ function getDocker() { } throw new Error("Could not connect to the docker socket"); } catch (error) { + console.error("Could not connect to docker socket"); throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "Could not connect to docker socket", @@ -140,6 +145,7 @@ async function getContainers(docker: Docker) { } throw Error("No containers found"); } catch (error) { + console.error("Could not get containers from docker socket"); throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "Could not get containers from docker socket",