mirror of
https://github.com/internetee/registry.git
synced 2025-05-28 11:11:11 +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
|
||||
helper_method :current_user
|
||||
|
||||
rescue_from CanCan::AccessDenied do |_exception|
|
||||
rescue_from StandardError do |e|
|
||||
@errors ||= []
|
||||
|
||||
if @errors.blank?
|
||||
@errors = [{
|
||||
msg: t('errors.messages.epp_authorization_error'),
|
||||
code: '2201'
|
||||
}]
|
||||
if e.class == CanCan::AccessDenied
|
||||
if @errors.blank?
|
||||
@errors = [{
|
||||
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
|
||||
|
||||
render_epp_response '/epp/error'
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue