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

fix: JES API error handling if job does not exist

This commit is contained in:
Mihajlo Medjedovic
2020-09-14 16:26:27 +02:00
parent 9af45799b9
commit afec560952

View File

@@ -1001,9 +1001,21 @@ export class SASViyaApiClient {
if (allJobsInFolder) {
const jobSpec = allJobsInFolder.find((j: Job) => j.name === jobName)
if (!jobSpec) {
console.error('Job was not found.')
throw new Error('Job was not found.')
}
const jobDefinitionLink = jobSpec?.links.find(
(l) => l.rel === 'getResource'
)?.href
if (!jobDefinitionLink) {
console.error('Job definition URI was not found.')
throw new Error('Job definition URI was not found.')
}
const requestInfo: any = {
method: 'GET'
}