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

helpers not found in rescue_from #1289

Closed
binary1101 opened this issue Feb 23, 2016 · 1 comment
Closed

helpers not found in rescue_from #1289

binary1101 opened this issue Feb 23, 2016 · 1 comment

Comments

@binary1101
Copy link

class API < Grape::API
  format :json
  helpers do
    def server_error!
      error!({ error: 'Server error.' }, 500, { 'Content-Type' => 'text/error' })
    end
  end

  rescue_from :all do |e|
    server_error!
  end

  get :test do
    fail 'test'
  end
end
Started GET "/api/test" for 127.0.0.1 at 2016-02-23 13:01:51 +0600

NoMethodError (undefined method `server_error!' for #<Grape::Middleware::Error:0x007fcf830dbb28>):
  app/api/api.rb:13:in `block in <class:API>'

@dblock
Copy link
Member

dblock commented Feb 23, 2016

This was implemented in #1232, hasn't shipped yet, but works on HEAD.

@dblock dblock closed this as completed Feb 23, 2016
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