mirror of
https://github.com/internetee/registry.git
synced 2025-05-29 17:10:08 +02:00
Rescue internal errors inside the app, not through mod_epp #2694
This commit is contained in:
parent
a2e6603ecc
commit
3f4139f613
1 changed files with 20 additions and 6 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue