@dynatrace-sdk/client-app-engine-edge-connect
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -5,2 +5,8 @@ # AppEngine - EdgeConnect | ||
## 1.5.0 | ||
### Features | ||
- Export errors from the package. | ||
## 1.4.0 | ||
@@ -7,0 +13,0 @@ |
403
cjs/index.js
@@ -38,3 +38,8 @@ /** | ||
__export(src_exports, { | ||
ApiClientError: () => import_shared_errors5.ApiClientError, | ||
ApiGatewayError: () => import_shared_errors5.ApiGatewayError, | ||
ClientRequestError: () => import_shared_errors5.ClientRequestError, | ||
EdgeConnectClient: () => EdgeConnectClient, | ||
ErrorResponseError: () => ErrorResponseError, | ||
InvalidResponseError: () => import_shared_errors5.InvalidResponseError, | ||
MetadataOauthClientStatus: () => MetadataOauthClientStatus, | ||
@@ -58,6 +63,7 @@ _ConstraintViolationTransformation: () => constraint_violation_transformation_exports, | ||
edgeConnectClient: () => edgeConnectClient, | ||
isApiClientError: () => isApiClientError, | ||
isClientRequestError: () => isClientRequestError, | ||
isApiClientError: () => import_shared_errors5.isApiClientError, | ||
isApiGatewayError: () => import_shared_errors5.isApiGatewayError, | ||
isClientRequestError: () => import_shared_errors5.isClientRequestError, | ||
isErrorResponseError: () => isErrorResponseError, | ||
isInvalidResponseError: () => isInvalidResponseError | ||
isInvalidResponseError: () => import_shared_errors5.isInvalidResponseError | ||
}); | ||
@@ -68,18 +74,4 @@ module.exports = __toCommonJS(src_exports); | ||
var import_http_client = require("@dynatrace-sdk/http-client"); | ||
var import_shared_errors4 = require("@dynatrace-sdk/shared-errors"); | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/api-client-error.ts | ||
var import_error_handlers = require("@dynatrace-sdk/error-handlers"); | ||
var ApiClientError = class extends Error { | ||
constructor(name, message, cause) { | ||
super(message); | ||
this.cause = cause; | ||
this.name = name; | ||
} | ||
isApiClientError = true; | ||
errorType = import_error_handlers.ErrorType.COMMON; | ||
}; | ||
function isApiClientError(e) { | ||
return e?.isApiClientError === true && e instanceof Error; | ||
} | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/api-gateway-errors-handler.ts | ||
@@ -94,21 +86,5 @@ var import_shared_errors = require("@dynatrace-sdk/shared-errors"); | ||
// 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; | ||
response; | ||
constructor(name, response, body, message, cause) { | ||
super(name, message, cause); | ||
this.errorType = import_error_handlers2.ErrorType.HTTP; | ||
this.body = body; | ||
this.response = response; | ||
} | ||
}; | ||
function isClientRequestError(e) { | ||
return e?.isApiClientError === true && e?.isClientRequestError === true && e instanceof Error; | ||
} | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/error-response-error.ts | ||
var ErrorResponseError = class extends ClientRequestError { | ||
var import_shared_errors2 = require("@dynatrace-sdk/shared-errors"); | ||
var ErrorResponseError = class extends import_shared_errors2.ClientRequestError { | ||
isErrorResponseError = true; | ||
@@ -121,5 +97,6 @@ }; | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/error-serializer.ts | ||
var import_error_handlers3 = require("@dynatrace-sdk/error-handlers"); | ||
var import_error_handlers = require("@dynatrace-sdk/error-handlers"); | ||
var import_shared_errors3 = require("@dynatrace-sdk/shared-errors"); | ||
var apiClientErrorSerializer = async (error) => { | ||
if (isClientRequestError(error)) { | ||
if ((0, import_shared_errors3.isClientRequestError)(error)) { | ||
const status = error.response.status; | ||
@@ -132,3 +109,3 @@ const message = error.message; | ||
stack: error.stack, | ||
type: import_error_handlers3.ErrorType.HTTP, | ||
type: import_error_handlers.ErrorType.HTTP, | ||
body: error.body, | ||
@@ -138,3 +115,3 @@ cause: error.cause, | ||
}; | ||
} else if (isApiClientError(error)) { | ||
} else if ((0, import_shared_errors3.isApiClientError)(error)) { | ||
return { | ||
@@ -144,3 +121,3 @@ name: error.name, | ||
stack: error.stack, | ||
type: import_error_handlers3.ErrorType.COMMON, | ||
type: import_error_handlers.ErrorType.COMMON, | ||
cause: error.cause | ||
@@ -152,5 +129,5 @@ }; | ||
function registerGlobalErrorSerializer(serializer) { | ||
if (!errorSerializerAdded && (0, import_error_handlers3.isGlobalErrorSerializerSupported)()) { | ||
if (!errorSerializerAdded && (0, import_error_handlers.isGlobalErrorSerializerSupported)()) { | ||
errorSerializerAdded = true; | ||
(0, import_error_handlers3.addGlobalErrorSerializer)(serializer); | ||
(0, import_error_handlers.addGlobalErrorSerializer)(serializer); | ||
} | ||
@@ -196,22 +173,2 @@ } | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/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?.isApiClientError === true && e?.isInvalidResponseError === true && e instanceof Error; | ||
} | ||
// packages/client/app-engine-edge-connect/src/lib/models/edge-connect.transformation.ts | ||
@@ -655,3 +612,3 @@ var edge_connect_transformation_exports = {}; | ||
if (!config) { | ||
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter"); | ||
throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter"); | ||
} | ||
@@ -671,3 +628,3 @@ const query = toQueryString({ | ||
}, | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -681,3 +638,3 @@ return [200].includes(status); | ||
} catch (err) { | ||
throw new InvalidResponseError( | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`EdgeConnectClient.listEdgeConnects:200`, | ||
@@ -687,22 +644,38 @@ err, | ||
void 0, | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
} | ||
} catch (e) { | ||
if ((0, import_http_client.isHttpClientAbortError)(e) || isInvalidResponseError(e)) { | ||
if ((0, import_http_client.isHttpClientAbortError)(e) || (0, import_shared_errors4.isInvalidResponseError)(e)) { | ||
throw e; | ||
} | ||
if (!(0, import_http_client.isHttpClientResponseError)(e)) { | ||
throw new ApiClientError("UnexpectedError", "Unexpected error", e); | ||
throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e); | ||
} | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new import_shared_errors4.ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof import_shared_errors4.ClientRequestError) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -744,3 +717,3 @@ } | ||
if (!config) { | ||
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter"); | ||
throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter"); | ||
} | ||
@@ -758,3 +731,3 @@ const encodedBody = toJson8(config.body); | ||
}, | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -768,3 +741,3 @@ return [201].includes(status); | ||
} catch (err) { | ||
throw new InvalidResponseError( | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`EdgeConnectClient.createEdgeConnect:201`, | ||
@@ -774,11 +747,12 @@ err, | ||
void 0, | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
} | ||
} catch (e) { | ||
if ((0, import_http_client.isHttpClientAbortError)(e) || isInvalidResponseError(e)) { | ||
if ((0, import_http_client.isHttpClientAbortError)(e) || (0, import_shared_errors4.isInvalidResponseError)(e)) { | ||
throw e; | ||
} | ||
if (!(0, import_http_client.isHttpClientResponseError)(e)) { | ||
throw new ApiClientError("UnexpectedError", "Unexpected error", e); | ||
throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e); | ||
} | ||
@@ -797,3 +771,3 @@ const response = e.response; | ||
} | ||
throw new InvalidResponseError( | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`EdgeConnectClient.createEdgeConnect:400`, | ||
@@ -803,3 +777,4 @@ err, | ||
"ErrorResponse", | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
@@ -809,10 +784,28 @@ } | ||
default: { | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new import_shared_errors4.ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage( | ||
responseValue, | ||
`Unexpected api response: code=${response.status} body="${responseValue}"` | ||
), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof import_shared_errors4.ClientRequestError) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -848,3 +841,3 @@ } | ||
}, | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -858,3 +851,3 @@ return [200].includes(status); | ||
} catch (err) { | ||
throw new InvalidResponseError( | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`EdgeConnectClient.getEdgeConnect:200`, | ||
@@ -864,22 +857,38 @@ err, | ||
void 0, | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
} | ||
} catch (e) { | ||
if ((0, import_http_client.isHttpClientAbortError)(e) || isInvalidResponseError(e)) { | ||
if ((0, import_http_client.isHttpClientAbortError)(e) || (0, import_shared_errors4.isInvalidResponseError)(e)) { | ||
throw e; | ||
} | ||
if (!(0, import_http_client.isHttpClientResponseError)(e)) { | ||
throw new ApiClientError("UnexpectedError", "Unexpected error", e); | ||
throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e); | ||
} | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new import_shared_errors4.ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof import_shared_errors4.ClientRequestError) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -913,3 +922,3 @@ } | ||
if (!config) { | ||
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter"); | ||
throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter"); | ||
} | ||
@@ -926,3 +935,3 @@ const encodedBody = toJson8(config.body); | ||
}, | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -938,3 +947,3 @@ return [200].includes(status); | ||
if (!(0, import_http_client.isHttpClientResponseError)(e)) { | ||
throw new ApiClientError("UnexpectedError", "Unexpected error", e); | ||
throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e); | ||
} | ||
@@ -953,3 +962,3 @@ const response = e.response; | ||
} | ||
throw new InvalidResponseError( | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`EdgeConnectClient.updateEdgeConnect:400`, | ||
@@ -959,3 +968,4 @@ err, | ||
"ErrorResponse", | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
@@ -965,10 +975,28 @@ } | ||
default: { | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new import_shared_errors4.ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage( | ||
responseValue, | ||
`Unexpected api response: code=${response.status} body="${responseValue}"` | ||
), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof import_shared_errors4.ClientRequestError) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -999,3 +1027,3 @@ } | ||
method: "DELETE", | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -1011,14 +1039,29 @@ return [204].includes(status); | ||
if (!(0, import_http_client.isHttpClientResponseError)(e)) { | ||
throw new ApiClientError("UnexpectedError", "Unexpected error", e); | ||
throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e); | ||
} | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new import_shared_errors4.ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof import_shared_errors4.ClientRequestError) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -1053,3 +1096,3 @@ } | ||
}, | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -1063,3 +1106,3 @@ return [200].includes(status); | ||
} catch (err) { | ||
throw new InvalidResponseError( | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`EdgeConnectClient.rotateOAuthClientSecret:200`, | ||
@@ -1069,11 +1112,12 @@ err, | ||
void 0, | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
} | ||
} catch (e) { | ||
if ((0, import_http_client.isHttpClientAbortError)(e) || isInvalidResponseError(e)) { | ||
if ((0, import_http_client.isHttpClientAbortError)(e) || (0, import_shared_errors4.isInvalidResponseError)(e)) { | ||
throw e; | ||
} | ||
if (!(0, import_http_client.isHttpClientResponseError)(e)) { | ||
throw new ApiClientError("UnexpectedError", "Unexpected error", e); | ||
throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e); | ||
} | ||
@@ -1088,3 +1132,3 @@ const response = e.response; | ||
); | ||
throw new ClientRequestError( | ||
throw new import_shared_errors4.ClientRequestError( | ||
`400`, | ||
@@ -1100,10 +1144,28 @@ response, | ||
default: { | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new import_shared_errors4.ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage( | ||
responseValue, | ||
`Unexpected api response: code=${response.status} body="${responseValue}"` | ||
), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof import_shared_errors4.ClientRequestError) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -1134,3 +1196,3 @@ } | ||
if (!config) { | ||
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter"); | ||
throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter"); | ||
} | ||
@@ -1145,3 +1207,3 @@ const query = toQueryString({ url: config.url }); | ||
}, | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -1155,3 +1217,3 @@ return [200].includes(status); | ||
} catch (err) { | ||
throw new InvalidResponseError( | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`EdgeConnectClient.getMatchedEdgeConnects:200`, | ||
@@ -1161,11 +1223,12 @@ err, | ||
void 0, | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
} | ||
} catch (e) { | ||
if ((0, import_http_client.isHttpClientAbortError)(e) || isInvalidResponseError(e)) { | ||
if ((0, import_http_client.isHttpClientAbortError)(e) || (0, import_shared_errors4.isInvalidResponseError)(e)) { | ||
throw e; | ||
} | ||
if (!(0, import_http_client.isHttpClientResponseError)(e)) { | ||
throw new ApiClientError("UnexpectedError", "Unexpected error", e); | ||
throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e); | ||
} | ||
@@ -1184,3 +1247,3 @@ const response = e.response; | ||
} | ||
throw new InvalidResponseError( | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`EdgeConnectClient.getMatchedEdgeConnects:400`, | ||
@@ -1190,3 +1253,4 @@ err, | ||
"ErrorResponse", | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
@@ -1196,10 +1260,28 @@ } | ||
default: { | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new import_shared_errors4.ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage( | ||
responseValue, | ||
`Unexpected api response: code=${response.status} body="${responseValue}"` | ||
), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof import_shared_errors4.ClientRequestError) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new import_shared_errors4.InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -1212,2 +1294,5 @@ } | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/index.ts | ||
var import_shared_errors5 = require("@dynatrace-sdk/shared-errors"); | ||
// packages/client/app-engine-edge-connect/src/lib/models/metadata-oauth-client-status.ts | ||
@@ -1214,0 +1299,0 @@ var MetadataOauthClientStatus = /* @__PURE__ */ ((MetadataOauthClientStatus2) => { |
{ | ||
"dynagen": { | ||
"version": "0.14.0", | ||
"version": "0.15.2", | ||
"generatedAt": "", | ||
"template": { | ||
"name": "@dynatrace-sdk/template-typescript-client", | ||
"version": "0.22.1" | ||
"version": "0.25.1" | ||
} | ||
@@ -9,0 +9,0 @@ }, |
359
esm/index.js
@@ -28,18 +28,9 @@ /** | ||
} from "@dynatrace-sdk/http-client"; | ||
import { | ||
ClientRequestError as ClientRequestError2, | ||
InvalidResponseError, | ||
isInvalidResponseError, | ||
ApiClientError | ||
} from "@dynatrace-sdk/shared-errors"; | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/api-client-error.ts | ||
import { ErrorType } from "@dynatrace-sdk/error-handlers"; | ||
var ApiClientError = class extends Error { | ||
constructor(name, message, cause) { | ||
super(message); | ||
this.cause = cause; | ||
this.name = name; | ||
} | ||
isApiClientError = true; | ||
errorType = ErrorType.COMMON; | ||
}; | ||
function isApiClientError(e) { | ||
return e?.isApiClientError === true && e instanceof Error; | ||
} | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/api-gateway-errors-handler.ts | ||
@@ -54,20 +45,4 @@ import { ApiGatewayError } from "@dynatrace-sdk/shared-errors"; | ||
// 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; | ||
response; | ||
constructor(name, response, body, message, cause) { | ||
super(name, message, cause); | ||
this.errorType = ErrorType2.HTTP; | ||
this.body = body; | ||
this.response = response; | ||
} | ||
}; | ||
function isClientRequestError(e) { | ||
return e?.isApiClientError === true && e?.isClientRequestError === true && e instanceof Error; | ||
} | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/error-response-error.ts | ||
import { ClientRequestError } from "@dynatrace-sdk/shared-errors"; | ||
var ErrorResponseError = class extends ClientRequestError { | ||
@@ -82,6 +57,7 @@ isErrorResponseError = true; | ||
import { | ||
ErrorType as ErrorType3, | ||
ErrorType, | ||
addGlobalErrorSerializer, | ||
isGlobalErrorSerializerSupported | ||
} from "@dynatrace-sdk/error-handlers"; | ||
import { isApiClientError, isClientRequestError } from "@dynatrace-sdk/shared-errors"; | ||
var apiClientErrorSerializer = async (error) => { | ||
@@ -96,3 +72,3 @@ if (isClientRequestError(error)) { | ||
stack: error.stack, | ||
type: ErrorType3.HTTP, | ||
type: ErrorType.HTTP, | ||
body: error.body, | ||
@@ -107,3 +83,3 @@ cause: error.cause, | ||
stack: error.stack, | ||
type: ErrorType3.COMMON, | ||
type: ErrorType.COMMON, | ||
cause: error.cause | ||
@@ -158,22 +134,2 @@ }; | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/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?.isApiClientError === true && e?.isInvalidResponseError === true && e instanceof Error; | ||
} | ||
// packages/client/app-engine-edge-connect/src/lib/models/edge-connect.transformation.ts | ||
@@ -632,3 +588,3 @@ var edge_connect_transformation_exports = {}; | ||
}, | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -647,3 +603,4 @@ return [200].includes(status); | ||
void 0, | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
@@ -660,10 +617,25 @@ } | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new ClientRequestError2( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof ClientRequestError2) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -718,3 +690,3 @@ } | ||
}, | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -733,3 +705,4 @@ return [201].includes(status); | ||
void 0, | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
@@ -761,3 +734,4 @@ } | ||
"ErrorResponse", | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
@@ -767,10 +741,28 @@ } | ||
default: { | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new ClientRequestError2( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage( | ||
responseValue, | ||
`Unexpected api response: code=${response.status} body="${responseValue}"` | ||
), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof ClientRequestError2) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -806,3 +798,3 @@ } | ||
}, | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -821,3 +813,4 @@ return [200].includes(status); | ||
void 0, | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
@@ -834,10 +827,25 @@ } | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new ClientRequestError2( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof ClientRequestError2) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -883,3 +891,3 @@ } | ||
}, | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -914,3 +922,4 @@ return [200].includes(status); | ||
"ErrorResponse", | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
@@ -920,10 +929,28 @@ } | ||
default: { | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new ClientRequestError2( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage( | ||
responseValue, | ||
`Unexpected api response: code=${response.status} body="${responseValue}"` | ||
), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof ClientRequestError2) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -954,3 +981,3 @@ } | ||
method: "DELETE", | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -970,10 +997,25 @@ return [204].includes(status); | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new ClientRequestError2( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof ClientRequestError2) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -1008,3 +1050,3 @@ } | ||
}, | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -1023,3 +1065,4 @@ return [200].includes(status); | ||
void 0, | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
@@ -1042,3 +1085,3 @@ } | ||
); | ||
throw new ClientRequestError( | ||
throw new ClientRequestError2( | ||
`400`, | ||
@@ -1054,10 +1097,28 @@ response, | ||
default: { | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new ClientRequestError2( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage( | ||
responseValue, | ||
`Unexpected api response: code=${response.status} body="${responseValue}"` | ||
), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof ClientRequestError2) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -1098,3 +1159,3 @@ } | ||
}, | ||
abortSignal: config.abortSignal, | ||
abortSignal: config instanceof EventTarget ? config : config.abortSignal, | ||
statusValidator: (status) => { | ||
@@ -1113,3 +1174,4 @@ return [200].includes(status); | ||
void 0, | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
@@ -1141,3 +1203,4 @@ } | ||
"ErrorResponse", | ||
void 0 | ||
void 0, | ||
response | ||
); | ||
@@ -1147,10 +1210,28 @@ } | ||
default: { | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new ClientRequestError( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`), | ||
e | ||
); | ||
try { | ||
const responseValue = await response.body("json"); | ||
throw new ClientRequestError2( | ||
`${response.status}`, | ||
response, | ||
responseValue, | ||
getErrorMessage( | ||
responseValue, | ||
`Unexpected api response: code=${response.status} body="${responseValue}"` | ||
), | ||
e | ||
); | ||
} catch (error) { | ||
if (error instanceof ClientRequestError2) { | ||
throw error; | ||
} | ||
const responseValue = await response.body("text").catch(() => ""); | ||
throw new InvalidResponseError( | ||
`${response.status}`, | ||
error, | ||
responseValue, | ||
"json", | ||
"Unexpected api response", | ||
response | ||
); | ||
} | ||
} | ||
@@ -1163,2 +1244,14 @@ } | ||
// packages/client/app-engine-edge-connect/src/lib/error-envelopes/index.ts | ||
import { | ||
ApiClientError as ApiClientError2, | ||
ApiGatewayError as ApiGatewayError2, | ||
ClientRequestError as ClientRequestError3, | ||
InvalidResponseError as InvalidResponseError2, | ||
isApiClientError as isApiClientError2, | ||
isApiGatewayError, | ||
isClientRequestError as isClientRequestError3, | ||
isInvalidResponseError as isInvalidResponseError2 | ||
} from "@dynatrace-sdk/shared-errors"; | ||
// packages/client/app-engine-edge-connect/src/lib/models/metadata-oauth-client-status.ts | ||
@@ -1173,3 +1266,8 @@ var MetadataOauthClientStatus = /* @__PURE__ */ ((MetadataOauthClientStatus2) => { | ||
export { | ||
ApiClientError2 as ApiClientError, | ||
ApiGatewayError2 as ApiGatewayError, | ||
ClientRequestError3 as ClientRequestError, | ||
EdgeConnectClient, | ||
ErrorResponseError, | ||
InvalidResponseError2 as InvalidResponseError, | ||
MetadataOauthClientStatus, | ||
@@ -1193,6 +1291,7 @@ constraint_violation_transformation_exports as _ConstraintViolationTransformation, | ||
edgeConnectClient, | ||
isApiClientError, | ||
isClientRequestError, | ||
isApiClientError2 as isApiClientError, | ||
isApiGatewayError, | ||
isClientRequestError3 as isClientRequestError, | ||
isErrorResponseError, | ||
isInvalidResponseError | ||
isInvalidResponseError2 as isInvalidResponseError | ||
}; |
{ | ||
"name": "@dynatrace-sdk/client-app-engine-edge-connect", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"dependencies": { | ||
"@dynatrace-sdk/error-handlers": "^1.2.0", | ||
"@dynatrace-sdk/http-client": "^1.2.0", | ||
"@dynatrace-sdk/shared-errors": "^0.0.2" | ||
"@dynatrace-sdk/shared-errors": "^1.0.0" | ||
}, | ||
@@ -9,0 +9,0 @@ "license": "Apache-2.0", |
189
README.md
# @dynatrace-sdk/client-app-engine-edge-connect | ||
[![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) | ||
[![npm](https://img.shields.io/badge/npm-v1.5.0-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-app-engine-edge-connect/v/1.5.0) | ||
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) | ||
@@ -78,2 +78,9 @@ | ||
#### Throws | ||
| Error Type | Error Message | | ||
|---|---| | ||
|ErrorResponseError|Bad Request| | ||
<details> | ||
@@ -134,2 +141,3 @@ <summary> | ||
<details> | ||
@@ -186,2 +194,3 @@ <summary> | ||
<details> | ||
@@ -240,2 +249,9 @@ <summary> | ||
#### Throws | ||
| Error Type | Error Message | | ||
|---|---| | ||
|ErrorResponseError|Bad Request| | ||
<details> | ||
@@ -295,2 +311,3 @@ <summary> | ||
<details> | ||
@@ -347,2 +364,3 @@ <summary> | ||
<details> | ||
@@ -397,2 +415,9 @@ <summary> | ||
#### Throws | ||
| Error Type | Error Message | | ||
|---|---| | ||
|ErrorResponseError|Bad Request| | ||
<details> | ||
@@ -426,2 +451,122 @@ <summary> | ||
### ApiClientError | ||
Base error for all client SDKs. All other errors extend this class. | ||
| Name | Type | Description | | ||
| --- | --- | --- | | ||
|cause|[any](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)| | | ||
|errorType<sup>*required</sup>|ErrorType| | | ||
|isApiClientError<sup>*required</sup>|true| | | ||
|message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|name<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|stack|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|prepareStackTrace|Object|Optional override for formatting stack traces | | ||
|stackTraceLimit<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| | | ||
### ApiGatewayError | ||
Dedicated error response class for errors thrown by API Gateway. | ||
Autogenerated SDK Clients have built-in handler for API Gateway errors that throws this error. | ||
| Name | Type | Description | | ||
| --- | --- | --- | | ||
|body<sup>*required</sup>|ApiGatewayErrorResponseBody| | | ||
|cause|[any](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)| | | ||
|code<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| | | ||
|errorType<sup>*required</sup>|ErrorType| | | ||
|isApiClientError<sup>*required</sup>|true| | | ||
|isApiGatewayError<sup>*required</sup>|true| | | ||
|isClientRequestError<sup>*required</sup>|true| | | ||
|message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|name<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|response<sup>*required</sup>|HttpClientResponse| | | ||
|retryAfterSeconds<sup>*required</sup>|undefined | [number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| | | ||
|stack|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|prepareStackTrace|Object|Optional override for formatting stack traces | | ||
|stackTraceLimit<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| | | ||
### ClientRequestError | ||
Generic error class for service errors, used to handle both expected and unexpected service-level errors. | ||
| Name | Type | Description | | ||
| --- | --- | --- | | ||
|body<sup>*required</sup>|DTO| | | ||
|cause|[any](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)| | | ||
|errorType<sup>*required</sup>|ErrorType| | | ||
|isApiClientError<sup>*required</sup>|true| | | ||
|isClientRequestError<sup>*required</sup>|true| | | ||
|message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|name<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|response<sup>*required</sup>|HttpClientResponse| | | ||
|stack|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|prepareStackTrace|Object|Optional override for formatting stack traces | | ||
|stackTraceLimit<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| | | ||
### ErrorResponseError | ||
Generic error class for service errors, used to handle both expected and unexpected service-level errors. | ||
| Name | Type | Description | | ||
| --- | --- | --- | | ||
|body<sup>*required</sup>|<a href="#errorresponse" target="_blank" rel="noopener noreferrer">ErrorResponse</a>| | | ||
|cause|[any](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)| | | ||
|errorType<sup>*required</sup>|ErrorType| | | ||
|isApiClientError<sup>*required</sup>|true| | | ||
|isClientRequestError<sup>*required</sup>|true| | | ||
|isErrorResponseError<sup>*required</sup>|true| | | ||
|message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|name<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|response<sup>*required</sup>|HttpClientResponse| | | ||
|stack|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|prepareStackTrace|Object|Optional override for formatting stack traces | | ||
|stackTraceLimit<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| | | ||
### InvalidResponseError | ||
Dedicated error class for errors related to response serialization. | ||
Thrown when received service response can't be deserialized. | ||
| Name | Type | Description | | ||
| --- | --- | --- | | ||
|cause|[any](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)| | | ||
|errorType<sup>*required</sup>|ErrorType| | | ||
|expectedType|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|isApiClientError<sup>*required</sup>|true| | | ||
|isInvalidResponseError<sup>*required</sup>|true| | | ||
|message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|name<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|nestedError|<a href="#error">Error</a>| | | ||
|response<sup>*required</sup>|[any](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)| | | ||
|responseBody<sup>*required</sup>|[any](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)| | | ||
|stack|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)| | | ||
|prepareStackTrace|Object|Optional override for formatting stack traces | | ||
|stackTraceLimit<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)| | | ||
### ConstraintViolation | ||
@@ -434,2 +579,4 @@ | ||
| Name | Type | | ||
@@ -446,2 +593,4 @@ | --- | --- | | ||
Maps the specified host patterns to this EdgeConnect | ||
@@ -469,2 +618,4 @@ | ||
| Name | Type | | ||
@@ -482,2 +633,4 @@ | --- | --- | | ||
| Name | Type | Description | | ||
@@ -495,2 +648,4 @@ | --- | --- | --- | | ||
| Name | Type | | ||
@@ -509,2 +664,4 @@ | --- | --- | | ||
| Name | Type | | ||
@@ -522,2 +679,4 @@ | --- | --- | | ||
| Name | Type | | ||
@@ -532,2 +691,4 @@ | --- | --- | | ||
Todo | ||
@@ -545,2 +706,4 @@ | ||
Contains information about the EdgeConnect and the matched pattern | ||
@@ -562,7 +725,9 @@ | ||
| Name | Type | | ||
| --- | --- | | ||
|matched|<a href="#matchededgeconnect" target="_blank" rel="noopener noreferrer">MatchedEdgeConnect</a>| | ||
|secondaryMatching|Array<<a href="#matchededgeconnect">MatchedEdgeConnect</a>>| | ||
| Name | Type | Description | | ||
| --- | --- | --- | | ||
|matched|<a href="#matchededgeconnect" target="_blank" rel="noopener noreferrer">MatchedEdgeConnect</a>|Contains information about the EdgeConnect and the matched pattern | | ||
|secondaryMatching|Array<<a href="#matchededgeconnect">MatchedEdgeConnect</a>>| | | ||
### Metadata | ||
@@ -575,7 +740,9 @@ | ||
| Name | Type | | ||
| --- | --- | | ||
|instances|Array<<a href="#edgeconnectinstance" target="_blank" rel="noopener noreferrer">EdgeConnectInstance</a>>| | ||
|oauthClientStatus|MetadataOauthClientStatus| | ||
| Name | Type | Description | | ||
| --- | --- | --- | | ||
|instances|Array<<a href="#edgeconnectinstance" target="_blank" rel="noopener noreferrer">EdgeConnectInstance</a>>| | | ||
|oauthClientStatus|MetadataOauthClientStatus|The status of the OAuth client | | ||
### ModificationInfo | ||
@@ -588,2 +755,4 @@ | ||
| Name | Type | | ||
@@ -601,2 +770,4 @@ | --- | --- | | ||
| Name | Type | | ||
@@ -603,0 +774,0 @@ | --- | --- | |
/** | ||
* ErrorResponse | ||
*/ | ||
import { ClientRequestError } from './client-request-error'; | ||
import { ClientRequestError } from '@dynatrace-sdk/shared-errors'; | ||
import { ErrorResponse } from '../models'; | ||
@@ -6,0 +6,0 @@ export declare class ErrorResponseError extends ClientRequestError<ErrorResponse> { |
@@ -1,4 +0,2 @@ | ||
export { isClientRequestError } from './client-request-error'; | ||
export { isApiClientError } from './api-client-error'; | ||
export { isInvalidResponseError } from './invalid-response-error'; | ||
export { isErrorResponseError } from './error-response-error'; | ||
export { ApiClientError, ApiGatewayError, ClientRequestError, InvalidResponseError, isApiClientError, isApiGatewayError, isClientRequestError, isInvalidResponseError, } from '@dynatrace-sdk/shared-errors'; | ||
export { ErrorResponseError, isErrorResponseError } from './error-response-error'; |
import { MatchedEdgeConnect } from './matched-edge-connect'; | ||
export interface MatchedResponse { | ||
/** | ||
* Contains information about the EdgeConnect and the matched pattern | ||
*/ | ||
matched?: MatchedEdgeConnect; | ||
secondaryMatching?: MatchedEdgeConnect[]; | ||
} |
@@ -5,3 +5,6 @@ import { EdgeConnectInstance } from './edge-connect-instance'; | ||
instances?: EdgeConnectInstance[]; | ||
/** | ||
* The status of the OAuth client | ||
*/ | ||
oauthClientStatus?: MetadataOauthClientStatus; | ||
} |
@@ -11,6 +11,6 @@ import { DataTypes } from './data-types'; | ||
* Can be `text`, `json`, `array-buffer`, `blob`, `readable-stream`, `buffer` or `stream`. | ||
* @throws DataTypeError when the data does not conform to the specified type. | ||
* @throws UnsupportedOperationError when the type is not supported by the platform. | ||
* @throws {DataTypeError} Data does not conform to the specified type. | ||
* @throws {UnsupportedOperationError} Type is not supported by the platform. | ||
*/ | ||
get<T extends keyof DataTypes>(type: T): DataTypes[T]; | ||
} |
@@ -29,6 +29,6 @@ import { ResponseBodyTypes } from './response-body-types'; | ||
* The default response body type is `json`. | ||
* @throws DataTypeError when the response body does not conform to the specified response body type. | ||
* @throws UnsupportedOperationError when the response body type is not supported by the platform. | ||
* @throws {DataTypeError} Response body does not conform to the specified response body type. | ||
* @throws {UnsupportedOperationError} Response body type is not supported by the platform. | ||
*/ | ||
body<T extends keyof ResponseBodyTypes = 'json'>(responseBodyType?: T): ResponseBodyTypes[T]; | ||
} |
import { ErrorType } from './types'; | ||
/** | ||
* Error base. All client errors should extend this class. | ||
* Base error for all client SDKs. All other errors extend this class. | ||
*/ | ||
@@ -11,2 +11,14 @@ export declare class ApiClientError extends Error { | ||
} | ||
/** | ||
* ApiClientError type guard function. | ||
* Does a structural check of the passed object. | ||
* @example | ||
* try { | ||
* doSomething(); | ||
* } catch (e: unknown) { | ||
* if(isApiClientError(e)) { | ||
* handleTheError(); | ||
* } | ||
* } | ||
*/ | ||
export declare function isApiClientError(e: any): e is ApiClientError; |
@@ -7,2 +7,5 @@ import { HttpClientResponse } from '@dynatrace-sdk/http-client'; | ||
}>; | ||
/** | ||
* Reference for *ApiGatewayError* details object. Contains information about received API Getaway error. | ||
* */ | ||
export interface ApiGatewayErrorDetails extends CommonErrorDetails { | ||
@@ -13,2 +16,6 @@ errorCodeProperties?: { | ||
} | ||
/** | ||
* Dedicated error response class for errors thrown by API Gateway. | ||
* Autogenerated SDK Clients have built-in handler for API Gateway errors that throws this error. | ||
*/ | ||
export declare class ApiGatewayError extends ClientRequestError<ApiGatewayErrorResponseBody> { | ||
@@ -20,2 +27,14 @@ readonly isApiGatewayError = true; | ||
} | ||
/** | ||
* APIGatewayError type guard function. | ||
* Does a structural check of the passed object. | ||
* @example | ||
* try { | ||
* doSomething(); | ||
* } catch (e: unknown) { | ||
* if(isApiClientError(e)) { | ||
* handleTheError(); | ||
* } | ||
* } | ||
*/ | ||
export declare function isApiGatewayError(e: any): e is ApiGatewayError; |
import { HttpClientResponse } from '@dynatrace-sdk/http-client'; | ||
import { ApiClientError } from './api-client-error'; | ||
import { ErrorResponseBody } from './types'; | ||
/** | ||
* Generic error class for service errors, used to handle both expected and unexpected service-level errors. | ||
* @example Handling unexpected error response, received by the SDK Client | ||
* const responseValue = await response.body('json'); | ||
* | ||
* throw new ClientRequestError( | ||
* `${response.status}`, | ||
* response, | ||
* responseValue, | ||
* getErrorMessage( | ||
* responseValue, | ||
* `Unexpected api response: code=${response.status} body="${responseValue}"`, | ||
* ), | ||
* e, | ||
* ); | ||
* | ||
*/ | ||
export declare class ClientRequestError<DTO = ErrorResponseBody> extends ApiClientError { | ||
@@ -10,2 +27,14 @@ readonly isClientRequestError = true; | ||
} | ||
/** | ||
* ClientRequestError type guard function. | ||
* Does a structural check of the passed object. | ||
* @example | ||
* try { | ||
* doSomething(); | ||
* } catch (e: unknown) { | ||
* if(isClientRequestError(e)) { | ||
* handleTheError(); | ||
* } | ||
* } | ||
*/ | ||
export declare function isClientRequestError(e: any): e is ClientRequestError; |
export * from './api-client-error'; | ||
export * from './api-gateway-error'; | ||
export * from './client-request-error'; | ||
export * from './sdk-error'; | ||
export * from './invalid-response-error'; | ||
export * from './types'; |
@@ -1,6 +0,2 @@ | ||
/** | ||
* Possible serialized error types | ||
* `COMMON`: Common JS error | ||
* `HTTP`: Error thrown by a http-client | ||
*/ | ||
/** @ignore*/ | ||
export declare enum ErrorType { | ||
@@ -10,23 +6,84 @@ COMMON = "JS Error", | ||
} | ||
/** | ||
* Basic error envelope, that enforces all error to have mandatory "error" property. | ||
* */ | ||
export interface ErrorResponseBody<T = CommonApiError> { | ||
/** | ||
* *error* object must have two mandatory fields (*code, message*) and may have two additional fields (*help, details*): | ||
* refer to the *CommonApiError* for more details. | ||
* */ | ||
error: T; | ||
} | ||
/** | ||
* Common API error structure, established by Dynatrace API guidelines. | ||
* */ | ||
export interface CommonApiError<T extends Record<string, any> = Record<string, any>> { | ||
/** The error code should be set to the HTTP error code by default.<br> | ||
* The error code may be set to an API-specific error code which must be properly documented.*/ | ||
code: number; | ||
/** The error message should be short and precise, it should not contain details.*/ | ||
message: string; | ||
/** | ||
* An additional help field may be added which must be a URL to further information on how to deal with the error.<br> | ||
* This may be some detailed error documentation page or a link to the Dynatrace support system, etc. | ||
* */ | ||
help?: string; | ||
/** | ||
* Additional details about the error may be added in a details field. | ||
* Refer to *CommonErrorDetails* | ||
* */ | ||
details?: T; | ||
} | ||
/** | ||
* *CommonApiError* details object reference. Contains common API error information. | ||
* This object is used to convey additional information about the error like e.g., which query parameter exactly violated a precondition. <br> | ||
* Details may contain any fields to further describe the error | ||
* */ | ||
export interface CommonErrorDetails { | ||
/** | ||
* UUID string that represents a reference of the error into e.g., the log file of the service. | ||
* */ | ||
errorRef?: string; | ||
/** | ||
* String containing a 32-character hex integer value that is used for tracing. | ||
* */ | ||
traceId?: string; | ||
/** | ||
* String value representing a more detailed error information than the http response code alone. | ||
* Must be a single word in CamelCase, and all possible values must be documented. | ||
* */ | ||
errorCode?: string; | ||
/** | ||
* An array of *ConstraintViolation* object, refer to ConstraintViolation object reference for more details. | ||
* */ | ||
constraintViolations?: ConstraintViolation[]; | ||
/** | ||
* Must be an array of strings containing a complete list of missing IAM scopes necessary to successfully execute the request. | ||
* Should be set if the API returns a 403 - Forbidden response in case of missing OAuth scopes. | ||
* */ | ||
missingScopes?: string[]; | ||
/** | ||
* Must be an array of strings containing a complete list of missing IAM permissions necessary to successfully execute the request. | ||
* Should be set if the API returns a 403 - Forbidden response in case of missing OAuth user permissions. | ||
* */ | ||
missingPermissions?: string[]; | ||
} | ||
/** | ||
* Contains information about an input parameter (path, query or request body) | ||
* that violated some validation rule of the service API and caused the warning.<br> | ||
* May contain additional fields further describing the warning. | ||
* */ | ||
export interface ConstraintViolation extends Record<string, string | undefined> { | ||
/** | ||
* Mandatory field message describing the warning. | ||
* */ | ||
message: string; | ||
/** | ||
* Describes the general location of the violating parameter (query parameter, request body, etc.) | ||
*/ | ||
parameterLocation?: string; | ||
/** | ||
* Refers to the violating parameter within the parameterLocation. | ||
*/ | ||
path?: 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
184445
4044
776
110
+ Added@dynatrace-sdk/shared-errors@1.0.0(transitive)
- Removed@dynatrace-sdk/shared-errors@0.0.2(transitive)