mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-16 08:30:07 +00:00
fix: error response stringify and added raw field
This commit is contained in:
@@ -2,14 +2,25 @@ export class ErrorResponse {
|
|||||||
body: ErrorBody
|
body: ErrorBody
|
||||||
|
|
||||||
constructor(message: string, details?: any) {
|
constructor(message: string, details?: any) {
|
||||||
|
let detailsString = '';
|
||||||
|
let raw
|
||||||
|
|
||||||
|
try {
|
||||||
|
detailsString = JSON.stringify(details)
|
||||||
|
} catch {
|
||||||
|
raw = details
|
||||||
|
}
|
||||||
|
|
||||||
this.body = {
|
this.body = {
|
||||||
message,
|
message,
|
||||||
details
|
details: detailsString,
|
||||||
|
raw
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ErrorBody {
|
interface ErrorBody {
|
||||||
message: string
|
message: string
|
||||||
details: any
|
details: string,
|
||||||
|
raw: any
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user