-
Notifications
You must be signed in to change notification settings - Fork 17
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
Conditions signaled from promises are invisible to the invoking environment #70
Comments
After digging a bit into this I realized that this is a limitation of |
@tzakharko what issue in |
I didn't find any issues in later opened by @tzakharko or that match the topic discussed here. It's hard to tell the full context of the original question, but if you're wanting to handle errors from code being evaluated as a promise, I recommend taking a look at the Access the results of a promise article in the promises docs. You can use the @bartekch do feel free to open a new issue for your question, especially if you can create a reprex for it. |
I have to admit that I don't remember the exact context. It doesn't seem I ever opened an issue with |
@tzakharko Thanks for checking back in! In terms of the snippet in this issue; it's definitely not expected to work. The conditions aren't signaled in a place visible to |
For (very) advanced scenarios, you can accomplish something that's sort of like Though, I would be slightly surprised if this is useful to anyone, unless they are writing a framework of some kind. |
@gadenbuie my case is almost exactly the same as OP - I want to intercept messages signaled in withCallingHandlers(
{
message("This message will be caught")
promises::future_promise(Sys.sleep(1)) |>
promises::then(function() message("I want this meesage to be caught as well"))
},
message = function(cnd) {
message("Got message: ", cnd$message)
}
)
#> Got message: This message will be caught
#> This message will be caught
#> I want this meesage to be caught as well I thought that it would work, since callback is run in the original process. I also got confused by the sentence From your comments I infer that it does NOT work like that. And, after some consideration, it actually makes some sense, because whole call to @jcheng5 I'm not exactly sure how should I use domains to address my issue, but anyway it seems like way too complicated for what I need, thanks for suggestion though! In the meantime I believe I found the forementioned issue in |
It seems that any signaled condition inside a promise is gobbled up by some hidden mechanism and will not be visible to the external handlers. The attached code illustrates this with messages (because they have a clear side effect), but I also tried it with other signals with the same effect.
Is there any obvious way to access signaled conditions outside of using external mechanisms (e.g. a callback).
The text was updated successfully, but these errors were encountered: