@dynatrace-sdk/error-handlers
v1.3.1
Published
Customize the handling of the errors originating from the app.
Downloads
15,994
Readme
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.