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

Add error attribute for access to thrown exceptions #4

Closed
wants to merge 1 commit into from
Closed

Add error attribute for access to thrown exceptions #4

wants to merge 1 commit into from

Conversation

troyk
Copy link

@troyk troyk commented Mar 15, 2014

Currently exceptions are converted to http status codes and the exception is swallowed. I might be missing something, but I need access to the exception. Let me know if you'd rather see the API implemented differently.

btw, lotus looks stellar and the performance with ruby 2.1.1 is inline with nodejs

@jodosha
Copy link
Member

jodosha commented Mar 15, 2014

@troyk Thanks for noticing this missing behavior, it's a good point.

However, I don't like the design. That #error method returns the last raised error. If another exception is raised, that reference would be lost.

I know that right now Controller's exception management short circuits the execution with throw so that, the control returns immediately to the framework and theoretically we shouldn't have new exceptions to trace. But I don't wont a public API method (#error) to rely on this internal mechanism. Also, I'm reluctant to expand the API if I'm not 100% sure. I hope this makes sense for you.

Rack protocol has a solution for this problem: rack.errors.

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

Successfully merging this pull request may close these issues.

2 participants