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

Improve user experience when using Puma #79

Closed
rosenfeld opened this issue Jul 22, 2016 · 4 comments
Closed

Improve user experience when using Puma #79

rosenfeld opened this issue Jul 22, 2016 · 4 comments

Comments

@rosenfeld
Copy link

Hi Jeremy, I'm not sure whether this Puma's behavior is intentional or not. But try running this on Puma:

# config.ru
require 'roda'

class App < Roda
  route do |r|
    require_relative 'abc' # it seems like Exceptions inheriting RuntimeError do not cause this, so maybe this is a bug. I'll report to Puma too.
  end
end

run App

# abc.rb
class # any invalid code

In Webrick we can see immediately what is the problem but Puma will ignore it silently and would cause ERR_EMPTY_RESPONSE error in Chrome. I guess it would be a good idea for Puma to rescue Exception on call and take some action rather than letting it propagate to the web server. What do you think?

@rosenfeld
Copy link
Author

This will cause the same issue in the browser with Puma, but at least it will report the error to the console:

run ->(env) {
  require_relative 'abc'
  [200, {}, []]
}

@rosenfeld
Copy link
Author

I'll report it to Puma anyway because it behaves differently when raise is used for example.

@jeremyevans
Copy link
Owner

Since this is server specific, you should probably report it to the server developers. If you want to rescue exceptions in your Roda application instead of raising them to the server, use the error_handler plugin.

@rosenfeld
Copy link
Author

puma/puma#1027

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