From b160c0d1e076c759fe251afd3c3b041319a00020 Mon Sep 17 00:00:00 2001 From: Sabir Hassan Date: Fri, 3 Feb 2023 19:16:18 +0500 Subject: [PATCH] fix: sasjs deploy should return error when deployment fails --- .../deploy/internal/deployToSASJSWithServicePack.ts | 8 ++++++-- .../deploy/internal/executeDeployScriptSasViya.ts | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/commands/deploy/internal/deployToSASJSWithServicePack.ts b/src/commands/deploy/internal/deployToSASJSWithServicePack.ts index 9f63a6c9..c73e0c8c 100644 --- a/src/commands/deploy/internal/deployToSASJSWithServicePack.ts +++ b/src/commands/deploy/internal/deployToSASJSWithServicePack.ts @@ -33,7 +33,8 @@ export async function deployToSasjsWithServicePack( result = await sasjsApiClient .deployZipFile(zipFilePath, authConfig) .catch((err) => { - process.logger?.error('deployToSASjs Error', err) + process.logger?.error('deployServicePack error', err) + throw new Error('Deploy service pack error') }) } else { const jsonContent = await readFile(jsonFilePath) @@ -42,7 +43,8 @@ export async function deployToSasjsWithServicePack( result = await sasjsApiClient .deploy(payload, target.appLoc, authConfig) .catch((err) => { - process.logger?.error('deployToSASjs Error', err) + process.logger?.error('deployServicePack error', err) + throw new Error('Deploy service pack error') }) } @@ -54,6 +56,8 @@ export async function deployToSasjsWithServicePack( `Payload example:\n${JSON.stringify(result.example, null, 2)}` ) } + + throw new Error('Deploy service pack error') } if (streamConfig?.streamWeb && result?.streamServiceName) { diff --git a/src/commands/deploy/internal/executeDeployScriptSasViya.ts b/src/commands/deploy/internal/executeDeployScriptSasViya.ts index ed5af239..3bd76c5a 100644 --- a/src/commands/deploy/internal/executeDeployScriptSasViya.ts +++ b/src/commands/deploy/internal/executeDeployScriptSasViya.ts @@ -69,8 +69,11 @@ export async function executeDeployScriptSasViya( await createFile(logFilePath, log) if (executionResult.completedWithError) { - process.logger?.error(`Log is available at ${logFilePath}`) - throw new Error('Deployment process completed with error') + process.logger?.error( + `Deployment failed with errors! Log is available at ${logFilePath}` + ) + + throw new Error(`Deployment failed.`) } process.logger?.success(