Open rrmartins opened 1 year ago
What's the complete call stack?
I found the problem. inside the Grape::Exceptions::ValidationErrors
return block, I had a Logger.debug. When doing an inspection of the running code, I noticed that there is something strange with the Rails.Logger.debug
when the ValidationErrors
object was sent. Then I realized that it was necessary to pass a "string" and not an object to be rendered.
# Before:
rescue_from Grape::Exceptions::ValidationErrors do |e|
error = { error: e.message, class: e.class.name, errors: e.errors }
Rails.logger.debug(e)
Rack::Response.new(error.to_json, e.status)
end
# After:
rescue_from Grape::Exceptions::ValidationErrors do |e|
error = { error: e.message, class: e.class.name, errors: e.errors }
Rails.logger.debug(error.to_json) <----- HERE
Rack::Response.new(error.to_json, e.status)
end
This could still be a bug. I expect Logger.debug(e)
to work for Grape::Exceptions::ValidationErrors
. Any interest in writing a spec for it and seeing if this is the case for all errors or just some errors?
hello, in my tests with cucumber I have a problem.
I'm getting a
wrong number of arguments (given 1, expected 0) (ArgumentError)
error when I try to make a request.I make a request that is missing parameters, I should get a 400 error with the missing parameter message.
so is my rescue_from: