diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/challenger-ui/src/hooks/session.ts | 2 | ||||
-rw-r--r-- | packages/taler-util/src/errors.ts | 4 | ||||
-rw-r--r-- | packages/taler-util/src/http-common.ts | 12 |
3 files changed, 17 insertions, 1 deletions
diff --git a/packages/challenger-ui/src/hooks/session.ts b/packages/challenger-ui/src/hooks/session.ts index 847b1fcca..eeb330493 100644 --- a/packages/challenger-ui/src/hooks/session.ts +++ b/packages/challenger-ui/src/hooks/session.ts @@ -121,7 +121,7 @@ export function useSessionState(): SessionStateHandler { }); return; } - // current status, FIXME: better check to know if the sate changed + // current status, FIXME: better check to know if the state changed const ls = state.lastStatus; if ( ls.changes_left !== st.changes_left || diff --git a/packages/taler-util/src/errors.ts b/packages/taler-util/src/errors.ts index 6becf7963..deb5d017b 100644 --- a/packages/taler-util/src/errors.ts +++ b/packages/taler-util/src/errors.ts @@ -107,6 +107,10 @@ export interface DetailsMap { requestUrl: string; requestMethod: string; httpStatusCode: number; + /** + * Original response which is malformed + */ + response?: string; validationError?: string; /** * Content type of the response, usually only specified if not the diff --git a/packages/taler-util/src/http-common.ts b/packages/taler-util/src/http-common.ts index d8cd36287..34be5a1d4 100644 --- a/packages/taler-util/src/http-common.ts +++ b/packages/taler-util/src/http-common.ts @@ -154,6 +154,7 @@ export async function readTalerErrorResponse( requestUrl: httpResponse.requestUrl, requestMethod: httpResponse.requestMethod, httpStatusCode: httpResponse.status, + response: await httpResponse.text(), validationError: e.toString(), }, "Couldn't parse JSON format from error response", @@ -173,6 +174,7 @@ export async function readTalerErrorResponse( requestUrl: httpResponse.requestUrl, requestMethod: httpResponse.requestMethod, httpStatusCode: httpResponse.status, + response: await httpResponse.text(), }, "Error response did not contain error code", ); @@ -193,6 +195,7 @@ export async function readUnexpectedResponseDetails( requestUrl: httpResponse.requestUrl, requestMethod: httpResponse.requestMethod, httpStatusCode: httpResponse.status, + response: await httpResponse.text(), validationError: e.toString(), }, "Couldn't parse JSON format from error response", @@ -206,6 +209,7 @@ export async function readUnexpectedResponseDetails( requestUrl: httpResponse.requestUrl, requestMethod: httpResponse.requestMethod, httpStatusCode: httpResponse.status, + response: await httpResponse.text(), }, "Error response did not contain error code", ); @@ -242,6 +246,7 @@ export async function readSuccessResponseJsonOrErrorCode<T>( requestUrl: httpResponse.requestUrl, requestMethod: httpResponse.requestMethod, httpStatusCode: httpResponse.status, + response: await httpResponse.text(), validationError: e.toString(), }, "Couldn't parse JSON format from response", @@ -257,6 +262,7 @@ export async function readSuccessResponseJsonOrErrorCode<T>( requestUrl: httpResponse.requestUrl, requestMethod: httpResponse.requestMethod, httpStatusCode: httpResponse.status, + response: await httpResponse.text(), validationError: e.toString(), }, "Response invalid", @@ -282,6 +288,7 @@ export async function readResponseJsonOrErrorCode<T>( requestUrl: httpResponse.requestUrl, requestMethod: httpResponse.requestMethod, httpStatusCode: httpResponse.status, + response: await httpResponse.text(), validationError: e.toString(), }, "Couldn't parse JSON format from response", @@ -297,6 +304,7 @@ export async function readResponseJsonOrErrorCode<T>( requestUrl: httpResponse.requestUrl, requestMethod: httpResponse.requestMethod, httpStatusCode: httpResponse.status, + response: await httpResponse.text(), validationError: e.toString(), }, "Response invalid", @@ -376,6 +384,7 @@ export async function readSuccessResponseTextOrErrorCode<T>( requestUrl: httpResponse.requestUrl, requestMethod: httpResponse.requestMethod, httpStatusCode: httpResponse.status, + response: await httpResponse.text(), validationError: e.toString(), }, "Couldn't parse JSON format from error response", @@ -389,6 +398,7 @@ export async function readSuccessResponseTextOrErrorCode<T>( { httpStatusCode: httpResponse.status, requestUrl: httpResponse.requestUrl, + response: await httpResponse.text(), requestMethod: httpResponse.requestMethod, }, "Error response did not contain error code", @@ -420,6 +430,7 @@ export async function checkSuccessResponseOrThrow( requestUrl: httpResponse.requestUrl, requestMethod: httpResponse.requestMethod, httpStatusCode: httpResponse.status, + response: await httpResponse.text(), validationError: e.toString(), }, "Couldn't parse JSON format from error response", @@ -433,6 +444,7 @@ export async function checkSuccessResponseOrThrow( { httpStatusCode: httpResponse.status, requestUrl: httpResponse.requestUrl, + response: await httpResponse.text(), requestMethod: httpResponse.requestMethod, }, "Error response did not contain error code", |