forked from External/greenlight
committed by
Jesus Federico
parent
9dd30138ba
commit
ee26036105
@ -111,7 +111,7 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
# Manually deal with 401 errors
|
||||
rescue_from CanCan::AccessDenied do |_exception|
|
||||
render "errors/not_found"
|
||||
render "errors/greenlight_error"
|
||||
end
|
||||
|
||||
# Checks to make sure that the admin has changed his password from the default
|
||||
@ -141,13 +141,18 @@ class ApplicationController < ActionController::Base
|
||||
retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials')
|
||||
rescue => e
|
||||
if e.message.eql? "No user with that id exists"
|
||||
render "errors/not_found", locals: { message: I18n.t("errors.not_found.user_not_found.message"),
|
||||
render "errors/greenlight_error", locals: { message: I18n.t("errors.not_found.user_not_found.message"),
|
||||
help: I18n.t("errors.not_found.user_not_found.help") }
|
||||
elsif e.message.eql? "Provider not included."
|
||||
render "errors/not_found", locals: { message: I18n.t("errors.not_found.user_missing.message"),
|
||||
render "errors/greenlight_error", locals: { message: I18n.t("errors.not_found.user_missing.message"),
|
||||
help: I18n.t("errors.not_found.user_missing.help") }
|
||||
elsif e.message.eql? "That user has no configured provider."
|
||||
render "errors/greenlight_error", locals: { status_code: 501,
|
||||
message: I18n.t("errors.no_provider.message"),
|
||||
help: I18n.t("errors.no_provider.help") }
|
||||
else
|
||||
render "errors/internal_error"
|
||||
render "errors/greenlight_error", locals: { status_code: 500, message: I18n.t("errors.internal.message"),
|
||||
help: I18n.t("errors.internal.help"), display_back: true }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -18,14 +18,21 @@
|
||||
|
||||
class ErrorsController < ApplicationController
|
||||
def not_found
|
||||
render status: 404, formats: :html
|
||||
render "greenlight_error", status: 404, formats: :html
|
||||
end
|
||||
|
||||
def internal_error
|
||||
render status: 500, formats: :html
|
||||
render "errors/greenlight_error", status: 500, formats: :html,
|
||||
locals: {
|
||||
status_code: 500,
|
||||
message: I18n.t("errors.internal.message"),
|
||||
help: I18n.t("errors.internal.help"),
|
||||
display_back: true
|
||||
}
|
||||
end
|
||||
|
||||
def unauthorized
|
||||
render status: 401, formats: :html
|
||||
render "errors/greenlight_error", status: 401, formats: :html, locals: { status_code: 401,
|
||||
message: I18n.t("errors.unauthorized.message"), help: I18n.t("errors.unauthorized.help"), display_back: true }
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user