Skip to content

Commit 8c5a3ed

Browse files
committed
ref(node): Use the isThenable function from @sentry/core to check whether it is a Promise
1 parent b31e2f0 commit 8c5a3ed

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

packages/node/src/integrations/tracing/hono/instrumentation.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Span } from '@opentelemetry/api';
22
import { context, SpanStatusCode, trace } from '@opentelemetry/api';
33
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
4+
import { isThenable } from '@sentry/core';
45
import { AttributeNames, HonoTypes } from './constants';
56
import type {
67
Context,
@@ -204,12 +205,7 @@ export class HonoInstrumentation extends InstrumentationBase {
204205
try {
205206
const result = execute();
206207

207-
if (
208-
result &&
209-
typeof result === 'object' &&
210-
typeof Object.getOwnPropertyDescriptor(result, 'then')?.value === 'function'
211-
) {
212-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
208+
if (isThenable(result)) {
213209
result.then(
214210
() => onSuccess(),
215211
(error: unknown) => onFailure(error),

0 commit comments

Comments
 (0)