diff --git a/src/error/index.ts b/src/error/index.ts index a30a5d4..1dce9cb 100644 --- a/src/error/index.ts +++ b/src/error/index.ts @@ -7,7 +7,7 @@ class SkyflowError extends Error { constructor(errorCode: ISkyflowError, args: any[] = []) { const formattedError = { http_status: errorCode?.http_status || BAD_REQUEST, - details: errorCode?.details || null, + details: errorCode?.details || [], request_ID: errorCode?.request_ID || null, grpc_code: errorCode?.grpc_code || null, http_code: errorCode.http_code, diff --git a/src/vault/client/index.ts b/src/vault/client/index.ts index 798dcc7..b43f454 100644 --- a/src/vault/client/index.ts +++ b/src/vault/client/index.ts @@ -144,7 +144,7 @@ class VaultClient { } private handleGenericError(err: any, requestId: string, reject: Function) { - const description = err?.message || errorMessages.ERROR_OCCURRED; + const description = err?.response?.data || err?.message || errorMessages.ERROR_OCCURRED; this.logAndRejectError(description, err, requestId, reject); }