1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 01:14:36 +00:00

fix: fetch session log for session failed/stopped state

This commit is contained in:
Saad Jutt
2021-05-03 18:26:22 +05:00
parent fef65bbfd2
commit 6f2f11d112

View File

@@ -412,7 +412,22 @@ export class SASViyaApiClient {
etag,
accessToken,
pollOptions
).catch((err) => {
).catch(async (err) => {
const error = err?.response?.data
const result = /err=[0-9]*,/.exec(error)
const errorCode = '5113'
if (result?.[0]?.slice(4, -1) === errorCode) {
const sessionLogUrl =
postedJob.links.find((l: any) => l.rel === 'up')!.href + '/log'
const logCount = 1000000
err.log = await fetchLogByChunks(
this.requestClient,
accessToken!,
sessionLogUrl,
logCount
)
}
throw prefixMessage(err, 'Error while polling job status. ')
})