diff options
Diffstat (limited to 'packages/taler-util/src/http-common.ts')
-rw-r--r-- | packages/taler-util/src/http-common.ts | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/packages/taler-util/src/http-common.ts b/packages/taler-util/src/http-common.ts index 817f2367f..da2fbb9da 100644 --- a/packages/taler-util/src/http-common.ts +++ b/packages/taler-util/src/http-common.ts @@ -180,37 +180,6 @@ export async function readTalerErrorResponse( return errJson; } -export async function readErrorResponse( - httpResponse: HttpResponse, -): Promise<{ detail: TalerErrorDetail | undefined, body: string }> { - let errString: string; - try { - errString = await httpResponse.text(); - } catch (e: any) { - throw TalerError.fromDetail( - TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, - { - requestUrl: httpResponse.requestUrl, - requestMethod: httpResponse.requestMethod, - httpStatusCode: httpResponse.status, - validationError: e.toString(), - }, - "Couldn't parse JSON format from error response", - ); - } - let errJson; - try { - errJson = JSON.parse(errString) - } catch (e) { - errJson = undefined - } - - const talerErrorCode = errJson && errJson.code; - if (typeof talerErrorCode === "number") { - return { detail: errJson, body: errString } - } - return { detail: undefined, body: errString }; -} export async function readUnexpectedResponseDetails( httpResponse: HttpResponse, ): Promise<TalerErrorDetail> { |