Skip to content

Commit a12070f

Browse files
authored
Merge pull request #92 from internetee/json-error-parse-rescue
json error parse rescue
2 parents 5398551 + 942cdee commit a12070f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/controllers/api/v1/callback_handler/callback_handler_controller.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module V1
33
module CallbackHandler
44
class CallbackHandlerController < ApplicationController
55
skip_before_action :authorized
6+
rescue_from JSON::ParserError, with: :render_wrong_format
67

78
api! 'Receives data from Everypay, when the payment was made by the customer'
89

@@ -41,6 +42,12 @@ def callback
4142

4243
render status: :ok, json: { message: result }
4344
end
45+
46+
private
47+
48+
def render_wrong_format
49+
render status: :unprocessable_entity, json: { message: 'Wrong format' }
50+
end
4451
end
4552
end
4653
end

0 commit comments

Comments
 (0)