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

fixed assignment default_error_formatter #477

Closed
wants to merge 1 commit into from
Closed

fixed assignment default_error_formatter #477

wants to merge 1 commit into from

Conversation

vad4msiu
Copy link
Contributor

I created json api with settings:

class Application < Grape::API
  ...
  content_type :json, "application/json"
  default_error_formatter :json
  error_formatter :json, ::Userbase::Errors::JsonFormatter
  ...
end

When I make request '/something' without '.json' I get rescue

NoMethodError:
 undefined method `call' for :json:Symbol
# ./lib/grape/middleware/error.rb:75:in `format_message'
# ./lib/grape/middleware/error.rb:63:in `error_response'
# ./lib/grape/middleware/error.rb:27:in `call!'
# ./lib/grape/middleware/base.rb:18:in `call'
# ./lib/grape/endpoint.rb:155:in `call!'
# ./lib/grape/endpoint.rb:145:in `call'
# ./lib/grape/api.rb:493:in `call'
# ./lib/grape/api.rb:42:in `call!'
# ./lib/grape/api.rb:38:in `call'

Because in method default_error_formatter assigned name formatter instead of being looking for via formatter_for.

@dblock
Copy link
Member

dblock commented Sep 26, 2013

Thanks, it's clearly a bug, merging. Do update CHANGELOG next time, please.

@dblock
Copy link
Member

dblock commented Sep 26, 2013

Merged via 6e418d3, thank you.

@dblock dblock closed this Sep 26, 2013
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.

None yet

2 participants