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

feat: service not found error handling for SAS9

This commit is contained in:
Mihajlo Medjedovic
2020-11-09 18:19:39 +01:00
parent d223e83c60
commit 4a4618dd32
2 changed files with 15 additions and 8 deletions

View File

@@ -1107,6 +1107,11 @@ export default class SASjs {
} }
} else { } else {
this.updateUsername(responseText) this.updateUsername(responseText)
if (responseText.includes('The requested URL /SASStoredProcess/do/ was not found on this server.') ||
responseText.includes('Stored process not found')) {
reject(new ErrorResponse('Service not found on the server', {service: sasJob}, responseText))
}
try { try {
const parsedJson = JSON.parse(responseText) const parsedJson = JSON.parse(responseText)
resolve(parsedJson) resolve(parsedJson)

View File

@@ -1,14 +1,16 @@
export class ErrorResponse { export class ErrorResponse {
error: ErrorBody error: ErrorBody
constructor(message: string, details?: any) { constructor(message: string, details?: any, raw?: any) {
let detailsString = '' let detailsString = details
let raw
if (typeof details !== 'object') {
try { try {
detailsString = JSON.stringify(details) detailsString = JSON.parse(details)
} catch { } catch {
raw = details raw = details
detailsString = ''
}
} }
this.error = { this.error = {