Fix API exception response handling

For some reason when using `render text:` instead of `render json:` for this response, the status code being returned was 200 instead of the clearly explicitly defined 422 (:unprocessable_entity). I absolutely have no idea why!
This commit is contained in:
Matt-Yorkley
2020-10-17 13:37:47 +01:00
parent f1002b953d
commit 0f2cbe8a52

View File

@@ -73,7 +73,7 @@ module Api
end
def error_during_processing(exception)
render(text: { exception: exception.message }.to_json,
render(json: { exception: exception.message },
status: :unprocessable_entity) && return
end