#{params[:location]}
"
if params[:location] == params[:url]
report += " on line #{params[:lineNumber]}
"
else
report += " in #{params[:url]}:#{params[:lineNumber]}
"
end
begin
# log the error
logger.info exception.to_s
logger.info exception.backtrace.join("\n")
UserMailer.send_mail(:error_report) do
[
"A JavaScript error has occurred",
report,
params[:message],
nil,
request,
params,
current_user,
]
end if Rails.env.preview? || Rails.env.production?
rescue exception2
logger.info exception2.to_s
logger.info exception2.backtrace.join("\n")
end
render json: {}
end
rescue_from ActiveRecord::RecordNotFound do |exception|
do_404
end
rescue_from ActiveRecord::PremissionDenied do |exception|
do_403
end
rescue_from AbstractController::ActionNotFound do |exception|
@banner_image = 'grafitti.jpg'
if current_user
@page_title = nil#'page_titles.Please_Login'
do_403 'not_a_translator'
#return
else
@page_title = 'page_titles.403.Please_Login'
do_403 'translator_login'
end
end
def locale_not_enabled!(locale = nil)
locale_not_available!(locale)
end
def locale_not_available!(locale = nil)
# set_default_locale
params[:_original_action] = params[:action]
params[:action] = 'error-locale-not-available'
@page_title = 'page_titles.404.Locale_Not_Available'
@main_title_vars = { vars: { language: view_context.language(locale) } }
@main_title = 'error.locale_not_available.title'
render 'application/locale_not_available', status: 404
end
rescue_from StandardError do |exception|
# log the error
logger.info exception.to_s
logger.info exception.backtrace.join("\n")
# send and email if this is production
suppress(Exception) do
UserMailer.send_mail(:error_report) do
[
"An error has occurred in #{Rails.env}",
nil,
exception.to_s,
exception.backtrace.join("\n"),
request,
params,
current_user,
]
end if Rails.env.preview? || Rails.env.production?
end
# raise the error if we are in development so that we can debug it
raise exception if Rails.env.development?
# show the error page
error_500 exception
end
def generate_confirmation(user, url, expiry = nil)
if user.is_a? String
user = User.find_by_email(user)
# if the user doesn't exist, just show them a 403
do_403 unless user.present?
end
expiry ||= (Time.now + 12.hours)
session[:confirm_uid] = user.id
# send the confirmation email and make sure it get sent as quickly as possible
UserMailer.send_mail :email_confirmation do
EmailConfirmation.create(user_id: user.id, expiry: expiry, url: url)
end
end
def user_settings
@conferences = Array.new
if logged_in?
Conference.all.each do | conference |
@conferences << conference if conference.host? current_user
end
end
@main_title = @page_title = 'page_titles.user_settings.Your_Account'
end
def contact
@main_title = @page_title = 'page_titles.contact.Contact_Us'
end
def contact_send
email_list = ['Godwin A translation for #{key}
in #{locale.to_s}
was found. The text that was rendered to the user was:
#{str || 'nil'}", exception.to_s, nil, request, params, current_user, ] end if Rails.env.preview? || Rails.env.production? rescue exception2 logger.info exception2.to_s logger.info exception2.backtrace.join("\n") end end end