Shared error classes for autogenerated Dynatrace SDK packages.
npm install @dynatrace-sdk/shared-errors---
title: "@dynatrace-sdk/shared-errors"
description: Shared error classes for autogenerated Dynatrace SDK packages.
---
Shared error classes for autogenerated Dynatrace SDK packages.
``bash`
npm install @dynatrace-sdk/shared-errors
#### Constructors
##### new ApiClientError(name,message?,cause?)
#### Properties
| Name | Type | Description |
| --- | --- | --- |
|cause|any| |
|errorType*required|ErrorType| |
|isApiClientError*required|true| |
#### Constructors
##### new ApiGatewayError(response,body)
#### Parameters
| Name | Type |
| --- | --- |
|response*required|HttpClientResponse|
|body*required|ApiGatewayErrorResponseBody|
#### Properties
| Name | Type | Description |
| --- | --- | --- |
|body*required|ApiGatewayErrorResponseBody| |
|cause|any| |
|code*required|number| |
|errorType*required|ErrorType| |
|isApiClientError*required|true| |
|isApiGatewayError*required|true| |
|isClientRequestError*required|true| |
|response*required|HttpClientResponse| |
|retryAfterSeconds*required|undefined | number| |
#### Constructors
##### new ClientRequestError(name,response,body,message?,cause?)
#### Parameters
| Name | Type |
| --- | --- |
|name*required|string|
|response*required|HttpClientResponse|
|body*required|DTO|
|message|string|
|cause|any|
#### Properties
| Name | Type | Description |
| --- | --- | --- |
|body*required|DTO| |
|cause|any| |
|errorType*required|ErrorType| |
|isApiClientError*required|true| |
|isClientRequestError*required|true| |
|response*required|HttpClientResponse| |
#### Constructors
##### new InvalidResponseError(name,nestedError,body,expectedType?,message?,response?)
#### Parameters
| Name | Type |
| --- | --- |
|name*required|string|
|nestedError*required|any|
|body*required|any|
|expectedType|string|
|message|string|
|response|any|
#### Properties
| Name | Type | Description |
| --- | --- | --- |
|cause|any| |
|errorType*required|ErrorType| |
|expectedType|string| |
|isApiClientError*required|true| |
|isInvalidResponseError*required|true| |
|nestedError|Error| |
|response*required|any| |
|responseBody*required|any| |
ApiClientError type guard function.
Does a structural check of the passed object.
#### Parameters
| Name | Type |
| --- | --- |
|e*required|any|
Code example
`ts`
try {
doSomething();
} catch (e: unknown) {
if(isApiClientError(e)) {
handleTheError();
}
}
APIGatewayError type guard function.
Does a structural check of the passed object.
#### Parameters
| Name | Type |
| --- | --- |
|e*required|any|
Code example
`ts`
try {
doSomething();
} catch (e: unknown) {
if(isApiClientError(e)) {
handleTheError();
}
}
ClientRequestError type guard function.
Does a structural check of the passed object.
#### Parameters
| Name | Type |
| --- | --- |
|e*required|any|
Code example
`ts`
try {
doSomething();
} catch (e: unknown) {
if(isClientRequestError(e)) {
handleTheError();
}
}
InvalidResponseError type guard function.
Does a structural check of the passed object.
#### Parameters
| Name | Type |
| --- | --- |
|e*required|any|
Code example
`ts``
try {
doSomething();
} catch (e: unknown) {
if (isInvalidResponseError(e)) {
throw e;
}
}
#### Properties
| Name | Type | Description |
| --- | --- | --- |
|constraintViolations|Array<ConstraintViolation>|An array of ConstraintViolation object, refer to ConstraintViolation object reference for more details. |
|errorCode|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.
|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.
|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.
|
#### Properties
| Name | Type | Description |
| --- | --- | --- |
|code*required|number|
The error code should be set to the HTTP error code by default.
The error code may be set to an API-specific error code which must be properly documented.
|Additional details about the error may be added in a details field. Refer to CommonErrorDetails
|An additional help field may be added which must be a URL to further information on how to deal with the error.
This may be some detailed error documentation page or a link to the Dynatrace support system, etc.
|Details may contain any fields to further describe the error
#### Properties
| Name | Type | Description |
| --- | --- | --- |
|constraintViolations|Array<ConstraintViolation>|An array of ConstraintViolation object, refer to ConstraintViolation object reference for more details. |
|errorCode|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.
|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.
|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.
|May contain additional fields further describing the warning.
#### Properties
| Name | Type | Description |
| --- | --- | --- |
|message*required|string|Mandatory field message describing the warning. |
|parameterLocation|string|Describes the general location of the violating parameter (query parameter, request body, etc.) |
|path|string|Refers to the violating parameter within the parameterLocation. |
#### Properties
| Name | Type | Description |
| --- | --- | --- |
|error*required|T|
error object must have two mandatory fields (code, message) and may have two additional fields (help, details): refer to the CommonApiError for more details.
|