1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-03 18:50:05 +00:00

fix: throw error from parseWeboutResponse function if unable to find webout response

This commit is contained in:
2021-08-18 16:33:26 +05:00
parent e72195ca5d
commit 3c9f133374
2 changed files with 7 additions and 8 deletions

View File

@@ -114,13 +114,9 @@ export class WebJobExecutor extends BaseJobExecutor {
resolve(jsonResponse)
}
if (this.serverType === ServerType.Sas9 && config.debug) {
let jsonResponse
if (typeof res.result === 'string') {
jsonResponse = parseWeboutResponse(res.result)
if (jsonResponse === '') throw new WeboutResponseError(apiUrl)
} else {
jsonResponse = res.result
}
let jsonResponse = res.result
if (typeof res.result === 'string')
jsonResponse = parseWeboutResponse(res.result, apiUrl)
getValidJson(jsonResponse)
this.appendRequest(res, sasJob, config.debug)

View File

@@ -1,4 +1,6 @@
export const parseWeboutResponse = (response: string) => {
import { WeboutResponseError } from '../types/errors'
export const parseWeboutResponse = (response: string, url?: string) => {
let sasResponse = ''
if (response.includes('>>weboutBEGIN<<')) {
@@ -7,6 +9,7 @@ export const parseWeboutResponse = (response: string) => {
.split('>>weboutBEGIN<<')[1]
.split('>>weboutEND<<')[0]
} catch (e) {
if (url) throw new WeboutResponseError(url)
sasResponse = ''
console.error(e)
}