File tree Expand file tree Collapse file tree 1 file changed +15
-22
lines changed
src/platforms/node/guides/koa Expand file tree Collapse file tree 1 file changed +15
-22
lines changed Original file line number Diff line number Diff line change @@ -68,31 +68,24 @@ Sentry.init({
6868});
6969
7070const requestHandler = (ctx , next ) => {
71- return new Promise ((resolve , reject ) => {
72- Sentry .runWithAsyncContext (async () => {
73- const hub = Sentry .getCurrentHub ();
74- hub .configureScope ((scope ) =>
75- scope .addEventProcessor ((event ) =>
76- Sentry .addRequestDataToEvent (event , ctx .request , {
77- include: {
78- user: false ,
79- },
80- })
81- )
82- );
83-
84- try {
85- await next ();
86- } catch (err) {
87- reject (err);
88- }
89- resolve ();
90- });
71+ Sentry .runWithAsyncContext (() => {
72+ const hub = Sentry .getCurrentHub ();
73+ hub .configureScope ((scope ) =>
74+ scope .addEventProcessor ((event ) =>
75+ Sentry .addRequestDataToEvent (event , ctx .request , {
76+ include: {
77+ user: false ,
78+ },
79+ })
80+ )
81+ );
82+
83+ next ();
9184 });
9285};
9386
9487// this tracing middleware creates a transaction per request
95- const tracingMiddleWare = async (ctx , next ) => {
88+ const tracingMiddleWare = (ctx , next ) => {
9689 const reqMethod = (ctx .method || " " ).toUpperCase ();
9790 const reqUrl = ctx .url && stripUrlQueryAndFragment (ctx .url );
9891
@@ -130,7 +123,7 @@ const tracingMiddleWare = async (ctx, next) => {
130123 });
131124 });
132125
133- await next ();
126+ next ();
134127};
135128
136129app .use (requestHandler);
You can’t perform that action at this time.
0 commit comments