From 53adfe89b107c10aca50dd129d7b0ed44d8174ee Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Sun, 8 Dec 2024 14:53:15 +0100 Subject: [PATCH] chore: skip errors with custom user configs in sentry --- packages/backend/src/modules/docker/docker.service.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/modules/docker/docker.service.ts b/packages/backend/src/modules/docker/docker.service.ts index d1fdcb5ef0..df381b4f4d 100644 --- a/packages/backend/src/modules/docker/docker.service.ts +++ b/packages/backend/src/modules/docker/docker.service.ts @@ -40,6 +40,7 @@ export class DockerService { * @param {string} appId - App name */ public getBaseComposeArgsApp = async (appId: string) => { + let isCustomConfig = false; const { directories } = this.config.getConfig(); const { storeId } = extractAppId(appId); @@ -50,6 +51,7 @@ export class DockerService { // User custom env file const userEnvFile = await this.appFilesManager.getUserEnv(appId); if (userEnvFile.content) { + isCustomConfig = true; args.push(`--env-file ${userEnvFile.path}`); } @@ -64,10 +66,11 @@ export class DockerService { // User defined overrides const userComposeFile = await this.appFilesManager.getUserComposeFile(appId); if (userComposeFile.content) { + isCustomConfig = true; args.push(`--file ${userComposeFile.path}`); } - return { args }; + return { args, isCustomConfig }; }; public getBaseComposeArgsRuntipi = async () => { @@ -94,13 +97,17 @@ export class DockerService { * @param {string} command - Command to execute */ public composeApp = async (appId: string, command: string) => { - const { args } = await this.getBaseComposeArgsApp(appId); + const { args, isCustomConfig } = await this.getBaseComposeArgsApp(appId); args.push(command); this.logger.info(`Running docker compose with args ${args.join(' ')}`); const { stdout, stderr } = await execAsync(`docker-compose ${args.join(' ')}`); if (stderr?.includes('Command failed:')) { + if (isCustomConfig) { + throw new Error(`Error with your custom app: ${stderr}`); + } + throw new Error(stderr); }