@ -125,7 +125,7 @@ class ApplicationController < LinguaFrancaApplicationController
report+=" in <code>#{params[:url]}:#{params[:lineNumber]}</code>"
report+=" in <code>#{params[:url]}:#{params[:lineNumber]}</code>"
end
end
suppress(Exception)do
begin
# log the error
# log the error
logger.infoexception.to_s
logger.infoexception.to_s
logger.infoexception.backtrace.join("\n")
logger.infoexception.backtrace.join("\n")
@ -141,6 +141,9 @@ class ApplicationController < LinguaFrancaApplicationController
current_user,
current_user,
]
]
endifRails.env.preview?||Rails.env.production?
endifRails.env.preview?||Rails.env.production?
rescueexception2
logger.infoexception2.to_s
logger.infoexception2.backtrace.join("\n")
end
end
renderjson:{}
renderjson:{}
end
end
@ -192,7 +195,7 @@ class ApplicationController < LinguaFrancaApplicationController
"An error has occurred in #{Rails.env}",
"An error has occurred in #{Rails.env}",
nil,
nil,
exception.to_s,
exception.to_s,
exception,
exception.backtrace.join("\n"),
request,
request,
params,
params,
current_user,
current_user,
@ -395,20 +398,25 @@ class ApplicationController < LinguaFrancaApplicationController
end
end
defi18n_exception(str,exception,locale,key)
defi18n_exception(str,exception,locale,key)
# log it
logger.info"Missing translation found for: #{key}"
# send and email if this is production
# send and email if this is production
suppress(Exception)do
begin
UserMailer.send_mail(:error_report)do
UserMailer.send_mail(:error_report)do
[
[
"A missing translation found in #{Rails.env}",
"A missing translation found in #{Rails.env}",
"<p>A translation for <code>#{key}</code> in <code>#{locale.to_s}</code> was found. The text that was rendered to the user was:</p><blockquote>#{str||'nil'}</blockquote>",
"<p>A translation for <code>#{key}</code> in <code>#{locale.to_s}</code> was found. The text that was rendered to the user was:</p><blockquote>#{str||'nil'}</blockquote>",
exception.to_s,
exception.to_s,
exception,
nil,
request,
request,
params,
params,
current_user,
current_user,
]
]
endifRails.env.preview?||Rails.env.production?
endifRails.env.preview?||Rails.env.production?
logger.info"Missing translation found for: #{key}"