From b6a2a85d1d4a916c799de30be4ede478fc841fb5 Mon Sep 17 00:00:00 2001 From: Mihajlo Medjedovic Date: Tue, 24 Nov 2020 11:59:17 +0100 Subject: [PATCH] fix: compute api log not appended to sasjs requests --- src/SASViyaApiClient.ts | 10 ++++------ src/SASjs.ts | 12 ++++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/SASViyaApiClient.ts b/src/SASViyaApiClient.ts index 71ad469..8ef99c1 100644 --- a/src/SASViyaApiClient.ts +++ b/src/SASViyaApiClient.ts @@ -606,12 +606,10 @@ export class SASViyaApiClient { throw err }) - return Promise.reject( - new ErrorResponse('Job execution failed.', { - status: 500, - body: log - }) - ) + return Promise.reject({ + status: 500, + log: log + }) } } return { diff --git a/src/SASjs.ts b/src/SASjs.ts index 27e0489..ee221aa 100644 --- a/src/SASjs.ts +++ b/src/SASjs.ts @@ -895,8 +895,8 @@ export default class SASjs { return responseJson }) - .catch(async (e) => { - if (needsRetry(JSON.stringify(e))) { + .catch(async (response) => { + if (needsRetry(JSON.stringify(response))) { if (this.retryCountJeseApi < requestRetryLimit) { let retryResponse = await this.executeJobViaJesApi( sasJob, @@ -917,11 +917,11 @@ export default class SASjs { } } - if (e?.log) { - this.appendSasjsRequest(e.log, sasJob, null) + if (response?.log) { + this.appendSasjsRequest(response.log, sasJob, null) } - if (e.toString().includes('Job was not found')) { + if (response.toString().includes('Job was not found')) { reject( new ErrorResponse('Service not found on the server.', { sasJob: sasJob @@ -929,7 +929,7 @@ export default class SASjs { ) } - reject(new ErrorResponse('Job execution failed.', e)) + reject(new ErrorResponse('Job execution failed.', response)) }) ) }