mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-03 18:50:05 +00:00
21 lines
471 B
TypeScript
21 lines
471 B
TypeScript
import { WeboutResponseError } from '../types/errors'
|
|
|
|
export const parseWeboutResponse = (response: string, url?: string): string => {
|
|
let sasResponse = ''
|
|
|
|
if (response.includes('>>weboutBEGIN<<')) {
|
|
try {
|
|
sasResponse = response
|
|
.split('>>weboutBEGIN<<')[1]
|
|
.split('>>weboutEND<<')[0]
|
|
} catch (e: any) {
|
|
if (url) throw new WeboutResponseError(url)
|
|
|
|
sasResponse = ''
|
|
console.error(e)
|
|
}
|
|
}
|
|
|
|
return sasResponse
|
|
}
|