Rescue internal errors inside the app, not through mod_epp #2694

This commit is contained in:
Martin Lensment 2015-07-01 17:01:02 +03:00
parent a2e6603ecc
commit 3f4139f613

View file

@ -10,15 +10,29 @@ class EppController < ApplicationController
before_action :update_epp_session before_action :update_epp_session
helper_method :current_user helper_method :current_user
rescue_from CanCan::AccessDenied do |_exception| rescue_from StandardError do |e|
@errors ||= [] @errors ||= []
if @errors.blank? if e.class == CanCan::AccessDenied
@errors = [{ if @errors.blank?
msg: t('errors.messages.epp_authorization_error'), @errors = [{
code: '2201' msg: t('errors.messages.epp_authorization_error'),
}] code: '2201'
}]
end
else
if @errors.blank?
@errors = [{
msg: 'Internal error.',
code: '2400'
}]
end
logger.error e.message
logger.error e.backtrace.join("\n")
# TODO: NOITFY AIRBRAKE / ERRBIT HERE
end end
render_epp_response '/epp/error' render_epp_response '/epp/error'
end end