diff --git a/src/SASViyaApiClient.ts b/src/SASViyaApiClient.ts index decbd1d..9b65355 100644 --- a/src/SASViyaApiClient.ts +++ b/src/SASViyaApiClient.ts @@ -1001,9 +1001,19 @@ export class SASViyaApiClient { if (allJobsInFolder) { const jobSpec = allJobsInFolder.find((j: Job) => j.name === jobName) + + if (!jobSpec) { + throw new Error('Job was not found.') + } + const jobDefinitionLink = jobSpec?.links.find( (l) => l.rel === 'getResource' )?.href + + if (!jobDefinitionLink) { + throw new Error('Job definition URI was not found.') + } + const requestInfo: any = { method: 'GET' }