fix: Cannot read properties of undefined (reading 'message')

This commit is contained in:
Tom Moor
2023-02-28 18:55:25 -05:00
parent 402406a3f7
commit 739a291a46

View File

@@ -106,8 +106,10 @@ export const traceFunction = (config: TraceConfig) => <
if (output && typeof output.then === "function") {
output
.catch((error: Error) => {
Tracing.setError(error, span);
.catch((error: Error | undefined) => {
if (error instanceof Error) {
Tracing.setError(error, span);
}
})
.finally(() => {
span.finish();