Throw a load of logging in as well
Some checks failed
Build and deploy / deploy (push) Failing after 45s
Some checks failed
Build and deploy / deploy (push) Failing after 45s
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user