Skip to content

Commit 5ec4427

Browse files
committed
Revert "try catch"
This reverts commit 481fc12.
1 parent 481fc12 commit 5ec4427

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,10 @@ export class SentryLangGraphInstrumentation extends InstrumentationBase<LangGrap
107107
}
108108

109109
// Patch createReactAgent to instrument the agent creation and invocation
110-
const wrappedCreateReactAgent = instrumentCreateReactAgent(exports.createReactAgent as (...args: unknown[]) => CompiledGraph, options);
111-
try {
112-
exports.createReactAgent = wrappedCreateReactAgent;
113-
} catch (error) {
110+
if (exports.createReactAgent && typeof exports.createReactAgent === 'function') {
111+
const originalCreateReactAgent = exports.createReactAgent;
114112
Object.defineProperty(exports, 'createReactAgent', {
115-
value: wrappedCreateReactAgent,
113+
value: instrumentCreateReactAgent(originalCreateReactAgent as (...args: unknown[]) => CompiledGraph, options),
116114
writable: true,
117115
enumerable: true,
118116
configurable: true,

0 commit comments

Comments
 (0)