@dynatrace-sdk/shared-errors
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -5,2 +5,8 @@ # shared-errors | ||
## 0.0.3 | ||
### Patch Changes | ||
- Added InvalidResponseError class. APPDEV-9585 | ||
## 0.0.2 | ||
@@ -10,3 +16,3 @@ | ||
- Introduced ApiClientError, ClientRequestError and ApiGatewayError. APPDEV-9219 | ||
- Introduced existing ApiClientError, ClientRequestError and the new ApiGatewayError. APPDEV-9219 | ||
@@ -13,0 +19,0 @@ ## 0.0.1 |
@@ -42,6 +42,8 @@ /** | ||
ErrorType: () => ErrorType, | ||
InvalidResponseError: () => InvalidResponseError, | ||
SDKError: () => SDKError, | ||
isApiClientError: () => isApiClientError, | ||
isApiGatewayError: () => isApiGatewayError, | ||
isClientRequestError: () => isClientRequestError | ||
isClientRequestError: () => isClientRequestError, | ||
isInvalidResponseError: () => isInvalidResponseError | ||
}); | ||
@@ -102,2 +104,22 @@ module.exports = __toCommonJS(src_exports); | ||
// packages/shared-errors/src/invalid-response-error.ts | ||
var InvalidResponseError = class extends ApiClientError { | ||
isInvalidResponseError = true; | ||
responseBody; | ||
expectedType; | ||
nestedError; | ||
constructor(name, nestedError, body, expectedType, message) { | ||
super( | ||
name, | ||
message ?? `${name}: Response does not match expected datatype${expectedType ? " " + expectedType : ""}: ${nestedError?.toString() ?? "unable to deserialize"}` | ||
); | ||
this.nestedError = nestedError; | ||
this.responseBody = body; | ||
this.expectedType = expectedType; | ||
} | ||
}; | ||
function isInvalidResponseError(e) { | ||
return e?.isInvalidResponseError === true && isApiClientError(e); | ||
} | ||
// packages/shared-errors/src/sdk-error.ts | ||
@@ -104,0 +126,0 @@ var SDKError = class extends Error { |
@@ -69,2 +69,22 @@ /** | ||
// packages/shared-errors/src/invalid-response-error.ts | ||
var InvalidResponseError = class extends ApiClientError { | ||
isInvalidResponseError = true; | ||
responseBody; | ||
expectedType; | ||
nestedError; | ||
constructor(name, nestedError, body, expectedType, message) { | ||
super( | ||
name, | ||
message ?? `${name}: Response does not match expected datatype${expectedType ? " " + expectedType : ""}: ${nestedError?.toString() ?? "unable to deserialize"}` | ||
); | ||
this.nestedError = nestedError; | ||
this.responseBody = body; | ||
this.expectedType = expectedType; | ||
} | ||
}; | ||
function isInvalidResponseError(e) { | ||
return e?.isInvalidResponseError === true && isApiClientError(e); | ||
} | ||
// packages/shared-errors/src/sdk-error.ts | ||
@@ -83,6 +103,8 @@ var SDKError = class extends Error { | ||
ErrorType, | ||
InvalidResponseError, | ||
SDKError, | ||
isApiClientError, | ||
isApiGatewayError, | ||
isClientRequestError | ||
isClientRequestError, | ||
isInvalidResponseError | ||
}; |
{ | ||
"name": "@dynatrace-sdk/shared-errors", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Shared error classes for autogenerated Dynatrace SDK packages.", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
export * from './api-client-error'; | ||
export * from './api-gateway-error'; | ||
export * from './client-request-error'; | ||
export * from './invalid-response-error'; | ||
export * from './sdk-error'; | ||
export * from './types'; |
21801
13
316