接口调用参数错误

dev_jupyter
daiao 5 years ago
parent 67197845c2
commit e2173ef50f

@ -10,6 +10,7 @@ module ControllerRescueHandler
Util.logger_error e Util.logger_error e
render json: {status: -1, message: "接口数据异常"} render json: {status: -1, message: "接口数据异常"}
end end
# rescue_from ActionView::MissingTemplate, with: :object_not_found # rescue_from ActionView::MissingTemplate, with: :object_not_found
# rescue_from ActiveRecord::RecordNotFound, with: :object_not_found # rescue_from ActiveRecord::RecordNotFound, with: :object_not_found
rescue_from Educoder::TipException, with: :tip_show rescue_from Educoder::TipException, with: :tip_show
@ -24,6 +25,11 @@ module ControllerRescueHandler
rescue_from ActiveRecord::RecordInvalid do |ex| rescue_from ActiveRecord::RecordInvalid do |ex|
render_error(ex.record.errors.full_messages.join(',')) render_error(ex.record.errors.full_messages.join(','))
end end
rescue_from ActionController::UnknownFormat do |e|
render json: {status: -1, message: "接口调用非JSON格式"}
end
# rescue_from RuntimeError do |ex| # rescue_from RuntimeError do |ex|
# Util.logger_error "#######ex:#{ex}" # Util.logger_error "#######ex:#{ex}"
# render_error(ex.message) # render_error(ex.message)

Loading…
Cancel
Save