-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emit more events #1395
base: master
Are you sure you want to change the base?
emit more events #1395
Changes from 1 commit
83940d0
4c4d064
82b5f1c
2faaa63
7303f20
c719bdb
0fc13d9
e4bf680
2d181dd
7190d4e
6b996ba
31911c4
4107093
4d70048
3b47e65
1bdfebb
0681713
c3369bf
bc62b2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
responded
to the socket
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,14 +164,15 @@ module.exports = class Application extends Emitter { | |
if (null != err) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the old code will execute There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fengmk2 |
||
ctx.onerror(err); | ||
this.emit(responding); | ||
} else this.emit('responded', ctx); | ||
} | ||
}; | ||
const handleResponse = () => { | ||
this.emit(responding); | ||
respond(ctx); | ||
}; | ||
this.emit('request', ctx); | ||
onFinished(res, onerror); | ||
onFinished(ctx.socket, () => { this.emit('responded', ctx); }); | ||
return fnMiddleware(ctx).then(handleResponse).catch(onerror); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exceptions like this make it less useful and more difficult to maintain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not an exception - it's a logic of this event because the response in this case never happened.