AndreasMadsen / async-hook

Inspect the life of handle objects in node
MIT License
36 stars 14 forks source link

If one of hook throws, where should it go? #8

Closed RobinQu closed 8 years ago

RobinQu commented 8 years ago

In the spec there is a didThrow parameter in post hook to indicate the process continues after exception in one of the hooks.

How should I accomplish the behavior above using async-hook?

'uncaughtException' event would allow me to handle the exception but it seems impossible to get uid of the handle it originates.

AndreasMadsen commented 8 years ago

I'm sorry, I don't think I understand the issue. Yes, I can see that didThrow is missing from the async-hook API, I will try and fix that.

AndreasMadsen commented 8 years ago

I've added didThrow support in https://github.com/AndreasMadsen/async-hook/commit/6d74837c901b2da3ebf70fbc391d642d3af0cede, does that solve the issue?

AndreasMadsen commented 8 years ago

I assume it solved the problem. Note that didThrow will soon be removed from AsyncWrap. If you are unhappy with that decision and has a good use case, you should tell them here: https://github.com/nodejs/node-eps/pull/18

RobinQu commented 8 years ago

Changes are huge...... I am trying to implement Zone with async_wrap. https://github.com/RobinQu/async-zone

AndreasMadsen commented 8 years ago

Nice, you ask questions about AsyncWrap here: https://github.com/nodejs/diagnostics