Skip to content
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

boom recursively to error #29

Open
moodymudskipper opened this issue May 30, 2021 · 2 comments
Open

boom recursively to error #29

moodymudskipper opened this issue May 30, 2021 · 2 comments

Comments

@moodymudskipper
Copy link
Owner

moodymudskipper commented May 30, 2021

We would have a function similar to rig but :

  • it rigs recursively the functions we find in the body
  • it doesn't print the boom output right away but sinks it somewhere
  • this boom output is "forgotten" if the call finishes
  • on error, we fetch back all these sunk outputs of unfinished calls and print them back

This way no need for debugonce hell, moreover the case when the error is in a function that was built at runtime (that we can't debugonce from the outside) is especially painful to debug but with this trick would be much less painful.

Looks not easy but useful.

@moodymudskipper
Copy link
Owner Author

moodymudskipper commented May 30, 2021

We might also boom recursively to a printed message, using regex.

https://twitter.com/antoine_fabri/status/1398012181174759433

The default behavior would be similar as in OP, so a step further than what the tweet hints to.

for completeness we can also boom to warning and boom to message

boom_to_error
boom_to_warning
boom_to_message
boom_to_output

This work might be leveraged for flow, we'd have on one hand the diagrams for the stack to error and on the other hand the boomed output for all those.

@moodymudskipper
Copy link
Owner Author

A first step is just to rig recursively, it's in fact very easy to draft, just rig and wrap where we previously just used wrap, with an exception for primitives, and add a parameter to indent 2 spaces more when we go deeper.

However this fails in recursive functions -> infinite recursion. Strangely even calls to .Internal() trigger this.

I think it might be solved by calling an overwrap ( instead of wrap) function called by rig ultimately the function would "rig itself" at runtime, avoiding the infinite recursion issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant