Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dynatrace-sdk/shared-errors

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dynatrace-sdk/shared-errors

Shared error classes for autogenerated Dynatrace SDK packages.

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

title: "@dynatrace-sdk/shared-errors" description: Shared error classes for autogenerated Dynatrace SDK packages.

@dynatrace-sdk/shared-errors

Shared error classes for autogenerated Dynatrace SDK packages.

npm install @dynatrace-sdk/shared-errors

Classes

ApiClientError

Base error for all client SDKs. All other errors extend this class.

Constructors
new ApiClientError(name,message?,cause?)
Parameters
NameType
name*requiredstring
messagestring
causeany
Properties
NameTypeDescription
causeany
errorType*requiredErrorType
isApiClientError*requiredtrue
message*requiredstring
name*requiredstring
stackstring
prepareStackTraceObjectOptional override for formatting stack traces
stackTraceLimit*requirednumber

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.

Constructors
new ApiGatewayError(response,body)
Parameters
NameType
response*requiredHttpClientResponse
body*requiredApiGatewayErrorResponseBody
Properties
NameTypeDescription
body*requiredApiGatewayErrorResponseBody
causeany
code*requirednumber
errorType*requiredErrorType
isApiClientError*requiredtrue
isApiGatewayError*requiredtrue
isClientRequestError*requiredtrue
message*requiredstring
name*requiredstring
response*requiredHttpClientResponse
retryAfterSeconds*requiredundefined | number
stackstring
prepareStackTraceObjectOptional override for formatting stack traces
stackTraceLimit*requirednumber

ClientRequestError

Generic error class for service errors, used to handle both expected and unexpected service-level errors.

Constructors
new ClientRequestError(name,response,body,message?,cause?)
Parameters
NameType
name*requiredstring
response*requiredHttpClientResponse
body*requiredDTO
messagestring
causeany
Properties
NameTypeDescription
body*requiredDTO
causeany
errorType*requiredErrorType
isApiClientError*requiredtrue
isClientRequestError*requiredtrue
message*requiredstring
name*requiredstring
response*requiredHttpClientResponse
stackstring
prepareStackTraceObjectOptional override for formatting stack traces
stackTraceLimit*requirednumber

InvalidResponseError

Dedicated error class for errors related to response serialization. Thrown when received service response can't be deserialized.

Constructors
new InvalidResponseError(name,nestedError,body,expectedType?,message?,response?)
Parameters
NameType
name*requiredstring
nestedError*requiredany
body*requiredany
expectedTypestring
messagestring
responseany
Properties
NameTypeDescription
causeany
errorType*requiredErrorType
expectedTypestring
isApiClientError*requiredtrue
isInvalidResponseError*requiredtrue
message*requiredstring
name*requiredstring
nestedErrorError
response*requiredany
responseBody*requiredany
stackstring
prepareStackTraceObjectOptional override for formatting stack traces
stackTraceLimit*requirednumber

Interfaces

ApiGatewayErrorDetails

Reference for ApiGatewayError details object. Contains information about received API Getaway error.

Properties
NameTypeDescription
constraintViolationsArray<ConstraintViolation>An array of ConstraintViolation object, refer to ConstraintViolation object reference for more details.
errorCodestring

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.

errorCodePropertiesObject
errorRefstringUUID string that represents a reference of the error into e.g., the log file of the service.
missingPermissionsArray<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.

missingScopesArray<string>

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.

traceIdstringString containing a 32-character hex integer value that is used for tracing.

CommonApiError

Common API error structure, established by Dynatrace API guidelines.

Properties
NameTypeDescription
code*requirednumber

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.

detailsT

Additional details about the error may be added in a details field. Refer to CommonErrorDetails

helpstring

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.

message*requiredstringThe error message should be short and precise, it should not contain details.

CommonErrorDetails

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.

Details may contain any fields to further describe the error

Properties
NameTypeDescription
constraintViolationsArray<ConstraintViolation>An array of ConstraintViolation object, refer to ConstraintViolation object reference for more details.
errorCodestring

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.

errorRefstringUUID string that represents a reference of the error into e.g., the log file of the service.
missingPermissionsArray<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.

missingScopesArray<string>

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.

traceIdstringString containing a 32-character hex integer value that is used for tracing.

ConstraintViolation

Contains information about an input parameter (path, query or request body) that violated some validation rule of the service API and caused the warning.

May contain additional fields further describing the warning.

Properties
NameTypeDescription
message*requiredstringMandatory field message describing the warning.
parameterLocationstringDescribes the general location of the violating parameter (query parameter, request body, etc.)
pathstringRefers to the violating parameter within the parameterLocation.

ErrorResponseBody

Basic error envelope, that enforces all error to have mandatory "error" property.

Properties
NameTypeDescription
error*requiredT

error object must have two mandatory fields (code, message) and may have two additional fields (help, details): refer to the CommonApiError for more details.

Functions

isApiClientError

isApiClientError(e):

ApiClientError type guard function. Does a structural check of the passed object.

Parameters
NameType
e*requiredany
Code example
try {
  doSomething();
} catch (e: unknown) {
  if(isApiClientError(e)) {
    handleTheError();
  }
}

isApiGatewayError

isApiGatewayError(e):

APIGatewayError type guard function. Does a structural check of the passed object.

Parameters
NameType
e*requiredany
Code example
try {
  doSomething();
} catch (e: unknown) {
  if(isApiClientError(e)) {
    handleTheError();
  }
}

isClientRequestError

isClientRequestError(e):

ClientRequestError type guard function. Does a structural check of the passed object.

Parameters
NameType
e*requiredany
Code example
try {
  doSomething();
} catch (e: unknown) {
  if(isClientRequestError(e)) {
    handleTheError();
  }
}

isInvalidResponseError

isInvalidResponseError(e):

InvalidResponseError type guard function. Does a structural check of the passed object.

Parameters
NameType
e*requiredany
Code example
try {
   doSomething();
} catch (e: unknown) {
   if (isInvalidResponseError(e)) {
     throw e;
   }
}

FAQs

Package last updated on 24 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc