jhudsl / matahari

🔎 I Spy With My Little Eye
Other
50 stars 4 forks source link

Errors not captured for logging flow #22

Open nischalshrestha opened 2 years ago

nischalshrestha commented 2 years ago

Thanks for creating a very useful package for logging executed expressions in RStudio!

I did come across a limitation I wanted to point out. If one only relied on dance_tbl(), the resulting table does not include code that produces an error, along with the error message. An example of executing on the console with error-producing code:

> dance_start()
> 2 + "foo"
Error in 2 + "foo" : non-numeric argument to binary operator
> dance_tbl()[['expr']]
[[1]]
sessionInfo()

[[2]]
dance_start()

The 2 + "foo" is not included.

However, this same ability is present if using dance_recital():

> dance_recital("2 + 'foo'")[['expr']]
[[1]]
2 + "foo"
> dance_recital("2 + 'foo'")[['error']]
[[1]]
<simpleError in 2 + "foo": non-numeric argument to binary operator>

I like the passive logging flow and was expecting it to also capture errors but it doesn't seem to be the case. Please let me know if there's a way to achieve it with dance_tbl() that I may have missed. Otherwise, it would be useful to include problematic code + error for dance_tbl().

seankross commented 2 years ago

Thanks for opening this. This is functionality I would like to add but I don't know how I could do this off the top of my head and I have too little bandwidth to work on this issue right now.