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({
68
68
});
69
69
70
70
const 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 ();
91
84
});
92
85
};
93
86
94
87
// this tracing middleware creates a transaction per request
95
- const tracingMiddleWare = async (ctx , next ) => {
88
+ const tracingMiddleWare = (ctx , next ) => {
96
89
const reqMethod = (ctx .method || " " ).toUpperCase ();
97
90
const reqUrl = ctx .url && stripUrlQueryAndFragment (ctx .url );
98
91
@@ -130,7 +123,7 @@ const tracingMiddleWare = async (ctx, next) => {
130
123
});
131
124
});
132
125
133
- await next ();
126
+ next ();
134
127
};
135
128
136
129
app .use (requestHandler);
You can’t perform that action at this time.
0 commit comments