1
0
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:
Mihajlo Medjedovic
2020-09-15 13:18:26 +02:00
parent a0ad8b3f34
commit 8504ec6c4d

View File

@@ -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
} }