@dynatrace-sdk/error-handlers
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

Error handlers

A Dynatrace AppEngine SDK library allowing to customize how the uncaught errors and rejected promises originating from the app are handled by the AppEngine.

npm install @dynatrace-sdk/error-handlers

Example usage

import {ErrorType, HttpSerializedError, addGlobalErrorSerializer} from "@dynatrace-sdk/error-handlers";

class CustomHttpError {
  constructor(
    readonly status: number,
    readonly name: string,
    readonly message: string,
  ) {
  }
}

addGlobalErrorSerializer(async (error) => {
  if (error instanceof CustomHttpError) {
    return <HttpSerializedError>{
      type: ErrorType.HTTP,
      name: error.name,
      status: error.status,
      message: error.message,
    }
  }
})

API reference

See the package reference in the Dynatrace Developer.

Dependents (14)

Package Sidebar

Install

npm i @dynatrace-sdk/error-handlers

Weekly Downloads

3,940

Version

1.3.1

License

Apache-2.0

Unpacked Size

30.4 kB

Total Files

26

Last publish

Collaborators

  • dynatrace-nodejs
  • stefan.wolfsteiner.dynatrace
  • wasserb