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

compose with file name & line number #479

Closed
robturtle opened this issue Mar 27, 2020 · 3 comments
Closed

compose with file name & line number #479

robturtle opened this issue Mar 27, 2020 · 3 comments

Comments

@robturtle
Copy link

class OneDay
  def execute
    compose(Eat)
    compose(Coding)
    compose(Sleep)
  end
end

Image if errors happened, there's no good way to tell where exactly the location the error happened in the first place. Especially when each sub-interactions also have its composed interactions. Basically the backtrace from the top-level interaction to the first scene of the errors will be swallowed.

It'd good if

  1. the errors remember the __FILE__ and __LINE__ of where errors.add happens
  2. when merging errors from the composed sub-interaction, it should retain the file location info in the errors
  3. probably the best place to save such info is in detailed_messages?
@AaronLasseigne
Copy link
Owner

I'm not sure how I'd go about doing this. I don't think I can force that information into the backtrace.

@robturtle
Copy link
Author

I think the easiest way is via https://stackoverflow.com/a/37135337/2214973.

@robturtle
Copy link
Author

robturtle commented Apr 11, 2020

I didn't look into the source yet. It depends on when does the exception being raised.

  • If the failed sub-interaction first return back to the top-level interaction and raise afterward, then the sub-interaction should wrap its caller information way up to the top-level.
  • If the failed sub-interaction raises in place, the compose method should simply set the backtrace from the error it captured.

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

2 participants