-
Notifications
You must be signed in to change notification settings - Fork 2
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
feature request: handle errors and warnings together peacfully #8
Comments
I'm not sure it's a trade-off. Two functions do two very different things, so it makes sense to separate them. But if you do want to have this function, it's just one compose away :)
You can then use it in place of It will even have nice property that your results will always be |
Thanks for the reply! I mean it's a trade-off in the sense that I need to decide ex-ante whether my function is going to throw an error (use safely) or a warning (use quietly). When do we know this in advance? So actually, it's not a trade-off, since in a typical workflow I will need to use both: safely, then if no errors occurs, replace it by quietly. So that's why I feel a And thanks for the code, very helpful! Now I would like to have it as a flat list (i.e. component result, output, warnings, message, error), I faced two issues:
Any idea how I could solve 1 or 2? Thanks a lot!!! use caseUse case would be for a case like:
Where I would show that first row gave an error, second a warning, and last two were ok. |
I'd actually been thinking along similar lines, since a common use case of collateral for me is running regression models where some problems might cause an error and some might cause warnings. If you're using |
Yes, same case for me: some regressions throw errors, some warnings, catching both is a daunting task so far with existing tools :-( And yes, the Thanks a lot!! |
Now that I've merged the PR changing the backend a little, this is on my immediate TODO list. Currently the I'll try to also add helpers for extracting components when I do this, as they'll work essentially the same way as the Re. flattened output, the API I'm trying to establish is that the collateral map variants give you the original
There're a few reasons for that decision:
The way I'm thinking about going about this currently is to have functions that return strings to be given to regular map functions. Right now, if you give But if you give it a character vector, it turns that into an extractor function, where each element steps down a level into each object in the column. That's how I currently check for the presence of side effects, and it's also how I currently recommend extracting results, as I show above. Passing With a
Note that The downside of this solution is that you'd have to give explicitly named variants for each class (it can't just be Anyway, that's what I'm thinking! If you have other thoughts, I'd love to hear them 🙂 |
I'm sorry, I should have mentioned this earlier: I've implemented |
thanks, looking forward to look at this, although will take some more time! |
No worries, Matthieu! I actually did some work yesterday after discovering a bug in Part of my implementation of |
Hi
Using
safely
orquietly
, one faces a weird trade-off: do I want to allow for errors or warnings? This raises two issues:safely
and has warnings: cannot catch themquietly
and has an error: function failsIdeally, on could just run one single function let's call its
peacefully
, that handles all of these ,i.e. return always slots like quietly plus error. I don't think this is available currently? Not sure whether this should be implemented at the purrr or collateral package though? Maybe start within collateral, and safely push to purrr later one? ;-)The text was updated successfully, but these errors were encountered: