aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util/src/errors.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-util/src/errors.ts')
-rw-r--r--packages/taler-util/src/errors.ts16
1 files changed, 11 insertions, 5 deletions
diff --git a/packages/taler-util/src/errors.ts b/packages/taler-util/src/errors.ts
index cbf4263fc..7439ba69d 100644
--- a/packages/taler-util/src/errors.ts
+++ b/packages/taler-util/src/errors.ts
@@ -103,6 +103,11 @@ export interface DetailsMap {
requestMethod: string;
httpStatusCode: number;
validationError?: string;
+ /**
+ * Content type of the response, usually only specified if not the
+ * expected content type.
+ */
+ contentType?: string;
};
[TalerErrorCode.WALLET_EXCHANGE_COIN_SIGNATURE_INVALID]: empty;
[TalerErrorCode.WALLET_WITHDRAWAL_GROUP_INCOMPLETE]: {
@@ -197,17 +202,19 @@ export class TalerProtocolViolationError extends Error {
}
// compute a subset of TalerError, just for http request
-type HttpErrors = TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT
+type HttpErrors =
+ | TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT
| TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED
| TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE
| TalerErrorCode.WALLET_NETWORK_ERROR
| TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR;
type TalerHttpErrorsDetails = {
- [code in HttpErrors]: TalerError<DetailsMap[code]>
-}
+ [code in HttpErrors]: TalerError<DetailsMap[code]>;
+};
-export type TalerHttpError = TalerHttpErrorsDetails[keyof TalerHttpErrorsDetails]
+export type TalerHttpError =
+ TalerHttpErrorsDetails[keyof TalerHttpErrorsDetails];
export class TalerError<T = any> extends Error {
errorDetail: TalerErrorDetail & T;
@@ -243,7 +250,6 @@ export class TalerError<T = any> extends Error {
): this is TalerError<DetailsMap[C]> {
return this.errorDetail.code === code;
}
-
}
/**