grape
grape copied to clipboard
NoMethodError: undefined method `serializable_hash' for #<Hash:0x00007fc3ef69c278> when error entity has root
Hello.
I try to add error root for errors.
class API::Error < Grape::Entity
root 'errors', 'error'
expose :code
expose :message
end
error!({ message: "Some error", code: 123, with: API::Error }, 400)
When error entity has root element, I have error:
NoMethodError: undefined method `serializable_hash' for #<Hash:0x00007fc3ef69c278>
/Users/nikolay/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/grape-1.1.0/lib/grape/error_formatter/base.rb:29:in `present'
Because Grape::Entity#represent method can return entity or hash, but
Grape::ErrorFormatter::Base#present is not ready for this result, and called to serializable_hash whatever the result.
@dblock Can I work on this?
Go for it @sinscary, no need to ask.