From afb6c85547dc0ec9100da4f2212f3be5f99e8fc1 Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Fri, 23 Sep 2022 19:17:25 +0100 Subject: [PATCH] fix(remix): Do not skip error handling if tracing is not enabled. --- packages/remix/src/utils/instrumentServer.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/remix/src/utils/instrumentServer.ts b/packages/remix/src/utils/instrumentServer.ts index bb37dffea8f3..f985b1866b4f 100644 --- a/packages/remix/src/utils/instrumentServer.ts +++ b/packages/remix/src/utils/instrumentServer.ts @@ -109,12 +109,12 @@ function makeWrappedDocumentRequestFunction( const activeTransaction = getActiveTransaction(); const currentScope = getCurrentHub().getScope(); - if (!activeTransaction || !currentScope) { + if (!currentScope) { return origDocumentRequestFunction.call(this, request, responseStatusCode, responseHeaders, context); } try { - const span = activeTransaction.startChild({ + const span = activeTransaction?.startChild({ op: 'remix.server.documentRequest', description: activeTransaction.name, tags: { @@ -125,7 +125,7 @@ function makeWrappedDocumentRequestFunction( res = await origDocumentRequestFunction.call(this, request, responseStatusCode, responseHeaders, context); - span.finish(); + span?.finish(); } catch (err) { captureRemixServerException(err, 'documentRequest'); throw err; @@ -141,12 +141,12 @@ function makeWrappedDataFunction(origFn: DataFunction, id: string, name: 'action const activeTransaction = getActiveTransaction(); const currentScope = getCurrentHub().getScope(); - if (!activeTransaction || !currentScope) { + if (!currentScope) { return origFn.call(this, args); } try { - const span = activeTransaction.startChild({ + const span = activeTransaction?.startChild({ op: `remix.server.${name}`, description: id, tags: { @@ -162,7 +162,7 @@ function makeWrappedDataFunction(origFn: DataFunction, id: string, name: 'action res = await origFn.call(this, args); currentScope.setSpan(activeTransaction); - span.finish(); + span?.finish(); } catch (err) { captureRemixServerException(err, name); throw err;