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

error reprex #20

Closed
moodymudskipper opened this issue Aug 23, 2022 · 4 comments
Closed

error reprex #20

moodymudskipper opened this issue Aug 23, 2022 · 4 comments
Milestone

Comments

@moodymudskipper
Copy link
Collaborator

Using options(error=) we can automate the inspection that we might do with options(error = recover)

for each frame we check the inputs of the call and construct() them. Then reproduce the error, the output is a knitted md report automatically open.

  • default path to temp file
  • default format to md but Cmd and html possible
  • open defaults to TRUE

NSE is tricky but we can probably deal with most use case with some effort, we can use delayAssign and try to eval what we can.
Just like construct() does we can check that we reproduce the same error, first with SE and implementing heuristics if it doesn't do it.

Maybe better in another package since it is a bit different and needs new deps. Also since we can reproduce the inputs we can also use flow_run() and {boomer} at each step and have a very detailed report of the error through different angles.

@moodymudskipper
Copy link
Collaborator Author

moodymudskipper commented Oct 2, 2022

out of scope, moved to debugverse
moodymudskipper/debugverse#35

@moodymudskipper
Copy link
Collaborator Author

Reopening as I changed my mind, this is useful and not necessarily that hard to do, at least for simple cases.

This doesn't need a dependency on reprex.

The following will reconstruct a but not b, it might also reconstruct foo

construct_reprex(foo(x = a, y = b), nse = "y")

We might be more general and construct every object that is needed, this would need more static analysis a la {flow}

construct_reprex({
  foo(x = a, y = b)
  ...
  }, nse = list(foo = "y")

Or maybe we don't worry about NSE and we just construct what exists ? and is used ? we might have false positives constructed but user can just remove those from produced code.

If object is found in data with same name, no code needed to reconstruct it.

If construct_reprex() is called without its main argument it will inspect sys.call(-1), and there it might inspect everything except args given through nse arg, or everything not yet evaled (less convenient probably)?

@moodymudskipper
Copy link
Collaborator Author

Or we just try to eval anyway, it's not super clean but the problematic cases (forcing a NSE expression that has wrong behaviour) should be really rare. This would make it really easy to design and use, we'd doc the caveats.

@moodymudskipper
Copy link
Collaborator Author

We can now use options(error = recover) with construct_reprex()

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

No branches or pull requests

1 participant