From c23e6352e2795e3ebabefd896d08795c1ebe120c Mon Sep 17 00:00:00 2001 From: Krishna Acondy Date: Wed, 2 Sep 2020 10:43:36 +0100 Subject: [PATCH] fix(logs): fetch log only when debug is switched on --- src/SASViyaApiClient.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SASViyaApiClient.ts b/src/SASViyaApiClient.ts index 226fb8c..b560076 100644 --- a/src/SASViyaApiClient.ts +++ b/src/SASViyaApiClient.ts @@ -301,11 +301,12 @@ export class SASViyaApiClient { { headers } ) - let jobResult, log + let jobResult + let log const logLink = currentJob.links.find((l) => l.rel === 'log') - if (true && logLink) { + if (debug && logLink) { log = await this.request( `${this.serverUrl}${logLink.href}/content?limit=10000`, { @@ -317,7 +318,7 @@ export class SASViyaApiClient { } if (jobStatus === 'failed' || jobStatus === 'error') { - return Promise.reject({ error: currentJob.error, log: log }) + return Promise.reject({ error: currentJob.error, log }) } const resultLink = `/compute/sessions/${executionSessionId}/filerefs/_webout/content`