@dynatrace-sdk/client-app-engine-edge-connect
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -5,5 +5,11 @@ # AppEngine - EdgeConnect | ||
## 1.4.0 | ||
### Minor Changes | ||
- Introduced @dynatrace-sdk/shared-errors package and improved response errors handling. | ||
## 1.3.0 | ||
* Add support for configuring host mappings. | ||
- Add support for configuring host mappings. | ||
@@ -10,0 +16,0 @@ ## 1.2.6 |
@@ -75,11 +75,22 @@ /** | ||
} | ||
isApiClientError = true; | ||
errorType = import_error_handlers.ErrorType.COMMON; | ||
}; | ||
function isApiClientError(e) { | ||
return e instanceof ApiClientError; | ||
return e?.isApiClientError === true && e instanceof Error; | ||
} | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/api-gateway-errors-handler.ts | ||
var import_shared_errors = require("@dynatrace-sdk/shared-errors"); | ||
async function apiGatewayErrorsHandler(response) { | ||
if (response.headers?.["dynatrace-response-source"] === "API Gateway") { | ||
const responseBody = await response.body("json"); | ||
throw new import_shared_errors.ApiGatewayError(response, responseBody); | ||
} | ||
} | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/client-request-error.ts | ||
var import_error_handlers2 = require("@dynatrace-sdk/error-handlers"); | ||
var ClientRequestError = class extends ApiClientError { | ||
isClientRequestError = true; | ||
body; | ||
@@ -95,3 +106,3 @@ response; | ||
function isClientRequestError(e) { | ||
return e instanceof ClientRequestError; | ||
return e?.isApiClientError === true && e?.isClientRequestError === true && e instanceof Error; | ||
} | ||
@@ -101,5 +112,6 @@ | ||
var ErrorResponseError = class extends ClientRequestError { | ||
isErrorResponseError = true; | ||
}; | ||
function isErrorResponseError(e) { | ||
return e instanceof ErrorResponseError; | ||
return e?.isApiClientError === true && e?.isClientRequestError === true && e?.isErrorResponseError === true && e instanceof Error; | ||
} | ||
@@ -180,2 +192,3 @@ | ||
var InvalidResponseError = class extends ApiClientError { | ||
isInvalidResponseError = true; | ||
responseBody; | ||
@@ -195,3 +208,3 @@ expectedType; | ||
function isInvalidResponseError(e) { | ||
return e instanceof InvalidResponseError; | ||
return e?.isApiClientError === true && e?.isInvalidResponseError === true && e instanceof Error; | ||
} | ||
@@ -630,2 +643,6 @@ | ||
* const data = await edgeConnectClient.listEdgeConnects(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -674,2 +691,3 @@ async listEdgeConnects(config = {}) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -711,2 +729,7 @@ throw new ClientRequestError( | ||
* }); | ||
* | ||
* @throws {ErrorResponseError} Bad Request | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -753,2 +776,3 @@ async createEdgeConnect(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
switch (response.status) { | ||
@@ -799,2 +823,6 @@ case 400: { | ||
* }); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -834,2 +862,3 @@ async getEdgeConnect(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -863,2 +892,7 @@ throw new ClientRequestError( | ||
* }); | ||
* | ||
* @throws {ErrorResponseError} Bad Request | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -893,2 +927,3 @@ async updateEdgeConnect(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
switch (response.status) { | ||
@@ -937,2 +972,6 @@ case 400: { | ||
* }); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -958,2 +997,3 @@ async deleteEdgeConnect(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -983,2 +1023,6 @@ throw new ClientRequestError( | ||
* }); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1018,2 +1062,3 @@ async rotateOAuthClientSecret(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
switch (response.status) { | ||
@@ -1061,2 +1106,7 @@ case 400: { | ||
* ); | ||
* | ||
* @throws {ErrorResponseError} Bad Request | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1100,2 +1150,3 @@ async getMatchedEdgeConnects(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
switch (response.status) { | ||
@@ -1102,0 +1153,0 @@ case 400: { |
{ | ||
"dynagen": { | ||
"version": "0.13.3", | ||
"version": "0.14.0", | ||
"generatedAt": "", | ||
"template": { | ||
"name": "@dynatrace-sdk/template-typescript-client", | ||
"version": "0.20.1" | ||
"version": "0.22.1" | ||
} | ||
@@ -9,0 +9,0 @@ }, |
@@ -37,11 +37,22 @@ /** | ||
} | ||
isApiClientError = true; | ||
errorType = ErrorType.COMMON; | ||
}; | ||
function isApiClientError(e) { | ||
return e instanceof ApiClientError; | ||
return e?.isApiClientError === true && e instanceof Error; | ||
} | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/api-gateway-errors-handler.ts | ||
import { ApiGatewayError } from "@dynatrace-sdk/shared-errors"; | ||
async function apiGatewayErrorsHandler(response) { | ||
if (response.headers?.["dynatrace-response-source"] === "API Gateway") { | ||
const responseBody = await response.body("json"); | ||
throw new ApiGatewayError(response, responseBody); | ||
} | ||
} | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/client-request-error.ts | ||
import { ErrorType as ErrorType2 } from "@dynatrace-sdk/error-handlers"; | ||
var ClientRequestError = class extends ApiClientError { | ||
isClientRequestError = true; | ||
body; | ||
@@ -57,3 +68,3 @@ response; | ||
function isClientRequestError(e) { | ||
return e instanceof ClientRequestError; | ||
return e?.isApiClientError === true && e?.isClientRequestError === true && e instanceof Error; | ||
} | ||
@@ -63,5 +74,6 @@ | ||
var ErrorResponseError = class extends ClientRequestError { | ||
isErrorResponseError = true; | ||
}; | ||
function isErrorResponseError(e) { | ||
return e instanceof ErrorResponseError; | ||
return e?.isApiClientError === true && e?.isClientRequestError === true && e?.isErrorResponseError === true && e instanceof Error; | ||
} | ||
@@ -146,2 +158,3 @@ | ||
var InvalidResponseError = class extends ApiClientError { | ||
isInvalidResponseError = true; | ||
responseBody; | ||
@@ -161,3 +174,3 @@ expectedType; | ||
function isInvalidResponseError(e) { | ||
return e instanceof InvalidResponseError; | ||
return e?.isApiClientError === true && e?.isInvalidResponseError === true && e instanceof Error; | ||
} | ||
@@ -596,2 +609,6 @@ | ||
* const data = await edgeConnectClient.listEdgeConnects(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -640,2 +657,3 @@ async listEdgeConnects(config = {}) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -677,2 +695,7 @@ throw new ClientRequestError( | ||
* }); | ||
* | ||
* @throws {ErrorResponseError} Bad Request | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -719,2 +742,3 @@ async createEdgeConnect(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
switch (response.status) { | ||
@@ -765,2 +789,6 @@ case 400: { | ||
* }); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -800,2 +828,3 @@ async getEdgeConnect(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -829,2 +858,7 @@ throw new ClientRequestError( | ||
* }); | ||
* | ||
* @throws {ErrorResponseError} Bad Request | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -859,2 +893,3 @@ async updateEdgeConnect(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
switch (response.status) { | ||
@@ -903,2 +938,6 @@ case 400: { | ||
* }); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -924,2 +963,3 @@ async deleteEdgeConnect(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -949,2 +989,6 @@ throw new ClientRequestError( | ||
* }); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -984,2 +1028,3 @@ async rotateOAuthClientSecret(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
switch (response.status) { | ||
@@ -1027,2 +1072,7 @@ case 400: { | ||
* ); | ||
* | ||
* @throws {ErrorResponseError} Bad Request | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1066,2 +1116,3 @@ async getMatchedEdgeConnects(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
switch (response.status) { | ||
@@ -1068,0 +1119,0 @@ case 400: { |
{ | ||
"name": "@dynatrace-sdk/client-app-engine-edge-connect", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"dependencies": { | ||
"@dynatrace-sdk/error-handlers": "^1.2.0", | ||
"@dynatrace-sdk/http-client": "^1.2.0" | ||
"@dynatrace-sdk/http-client": "^1.2.0", | ||
"@dynatrace-sdk/shared-errors": "^0.0.2" | ||
}, | ||
@@ -8,0 +9,0 @@ "license": "Apache-2.0", |
# @dynatrace-sdk/client-app-engine-edge-connect | ||
[![npm](https://img.shields.io/badge/npm-v1.3.0-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-app-engine-edge-connect/v/1.3.0) | ||
[![npm](https://img.shields.io/badge/npm-v1.4.0-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-app-engine-edge-connect/v/1.4.0) | ||
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) | ||
@@ -5,0 +5,0 @@ |
@@ -25,2 +25,6 @@ import { AbortSignal, HttpClient } from '@dynatrace-sdk/http-client'; | ||
* const data = await edgeConnectClient.listEdgeConnects(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -92,2 +96,7 @@ listEdgeConnects(config?: { | ||
* }); | ||
* | ||
* @throws {ErrorResponseError} Bad Request | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -111,2 +120,6 @@ createEdgeConnect(config: { | ||
* }); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -135,2 +148,7 @@ getEdgeConnect(config: { | ||
* }); | ||
* | ||
* @throws {ErrorResponseError} Bad Request | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -153,2 +171,6 @@ updateEdgeConnect(config: { | ||
* }); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -173,2 +195,6 @@ deleteEdgeConnect(config: { | ||
* }); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -192,2 +218,7 @@ rotateOAuthClientSecret(config: { | ||
* ); | ||
* | ||
* @throws {ErrorResponseError} Bad Request | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -194,0 +225,0 @@ getMatchedEdgeConnects(config: { |
@@ -7,2 +7,3 @@ import { ErrorType } from '@dynatrace-sdk/error-handlers'; | ||
readonly cause?: any; | ||
readonly isApiClientError = true; | ||
errorType: ErrorType; | ||
@@ -9,0 +10,0 @@ constructor(name: string, message?: string, cause?: any); |
import { HttpClientResponse } from '@dynatrace-sdk/http-client'; | ||
import { ApiClientError } from './api-client-error'; | ||
export declare class ClientRequestError<DTO> extends ApiClientError { | ||
readonly isClientRequestError = true; | ||
body: DTO; | ||
@@ -5,0 +6,0 @@ response: HttpClientResponse; |
@@ -7,3 +7,4 @@ /** | ||
export declare class ErrorResponseError extends ClientRequestError<ErrorResponse> { | ||
readonly isErrorResponseError = true; | ||
} | ||
export declare function isErrorResponseError(e: any): e is ErrorResponseError; |
import { ApiClientError } from './api-client-error'; | ||
export declare class InvalidResponseError extends ApiClientError { | ||
readonly isInvalidResponseError = true; | ||
responseBody: any; | ||
@@ -4,0 +5,0 @@ expectedType?: string; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
167957
113
3743
3
+ Added@dynatrace-sdk/shared-errors@0.0.2(transitive)