1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-05 11:40:06 +00:00

fix(error-handling): added catch block to poll job state

This commit is contained in:
Yury Shkoda
2021-03-09 09:35:01 +03:00
parent 47be5e77e5
commit a977f59675
2 changed files with 10 additions and 2 deletions

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,9 @@ 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. ')
})