Merge pull request #5650 from tchak/graphql-parse-errors
GraphQL handle parse errors
This commit is contained in:
commit
5e081dd85b
1 changed files with 6 additions and 0 deletions
|
@ -18,6 +18,12 @@ class API::V2::GraphqlController < API::V2::BaseController
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def process_action(*args)
|
||||||
|
super
|
||||||
|
rescue ActionDispatch::Http::Parameters::ParseError => exception
|
||||||
|
render status: 400, json: { errors: [{ message: exception.cause.message }] }
|
||||||
|
end
|
||||||
|
|
||||||
# Handle form data, JSON body, or a blank value
|
# Handle form data, JSON body, or a blank value
|
||||||
def ensure_hash(ambiguous_param)
|
def ensure_hash(ambiguous_param)
|
||||||
case ambiguous_param
|
case ambiguous_param
|
||||||
|
|
Loading…
Reference in a new issue