mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-06 20:10:05 +00:00
fix: throw error from parseWeboutResponse function if unable to find webout response
This commit is contained in:
@@ -114,13 +114,9 @@ export class WebJobExecutor extends BaseJobExecutor {
|
|||||||
resolve(jsonResponse)
|
resolve(jsonResponse)
|
||||||
}
|
}
|
||||||
if (this.serverType === ServerType.Sas9 && config.debug) {
|
if (this.serverType === ServerType.Sas9 && config.debug) {
|
||||||
let jsonResponse
|
let jsonResponse = res.result
|
||||||
if (typeof res.result === 'string') {
|
if (typeof res.result === 'string')
|
||||||
jsonResponse = parseWeboutResponse(res.result)
|
jsonResponse = parseWeboutResponse(res.result, apiUrl)
|
||||||
if (jsonResponse === '') throw new WeboutResponseError(apiUrl)
|
|
||||||
} else {
|
|
||||||
jsonResponse = res.result
|
|
||||||
}
|
|
||||||
|
|
||||||
getValidJson(jsonResponse)
|
getValidJson(jsonResponse)
|
||||||
this.appendRequest(res, sasJob, config.debug)
|
this.appendRequest(res, sasJob, config.debug)
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export const parseWeboutResponse = (response: string) => {
|
import { WeboutResponseError } from '../types/errors'
|
||||||
|
|
||||||
|
export const parseWeboutResponse = (response: string, url?: string) => {
|
||||||
let sasResponse = ''
|
let sasResponse = ''
|
||||||
|
|
||||||
if (response.includes('>>weboutBEGIN<<')) {
|
if (response.includes('>>weboutBEGIN<<')) {
|
||||||
@@ -7,6 +9,7 @@ export const parseWeboutResponse = (response: string) => {
|
|||||||
.split('>>weboutBEGIN<<')[1]
|
.split('>>weboutBEGIN<<')[1]
|
||||||
.split('>>weboutEND<<')[0]
|
.split('>>weboutEND<<')[0]
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (url) throw new WeboutResponseError(url)
|
||||||
sasResponse = ''
|
sasResponse = ''
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user