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

Merge pull request #277 from sasjs/error-handling

fix(error-handling): added catch block to poll job state
This commit is contained in:
Yury Shkoda
2021-03-09 10:24:14 +03:00
committed by GitHub
4 changed files with 17272 additions and 50 deletions

17303
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -58,8 +58,8 @@
},
"main": "index.js",
"dependencies": {
"axios": "^0.21.1",
"@sasjs/utils": "^2.5.0",
"axios": "^0.21.1",
"form-data": "^3.0.0",
"https": "^1.0.0"
}

View File

@@ -977,7 +977,13 @@ export class SASViyaApiClient {
postJobRequestBody,
accessToken
)
const jobStatus = await this.pollJobState(postedJob, etag, accessToken)
const jobStatus = await this.pollJobState(
postedJob,
etag,
accessToken
).catch((err) => {
throw prefixMessage(err, 'Error while polling job status. ')
})
const { result: currentJob } = await this.requestClient.get<Job>(
`${this.serverUrl}/jobExecution/jobs/${postedJob.id}`,
accessToken

View File

@@ -97,7 +97,14 @@ export class RequestClient implements HttpClient {
})
.catch(async (e) => {
return await this.handleError(e, () =>
this.get<T>(url, accessToken, contentType, overrideHeaders)
this.get<T>(url, accessToken, contentType, overrideHeaders).catch(
(err) => {
throw prefixMessage(
err,
'Error while executing handle error callback. '
)
}
)
).catch((err) => {
throw prefixMessage(err, 'Error while handling error. ')
})