diff --git a/app/controllers/cost_reports_controller.rb b/app/controllers/cost_reports_controller.rb index 59eef3348c..10eed31521 100644 --- a/app/controllers/cost_reports_controller.rb +++ b/app/controllers/cost_reports_controller.rb @@ -6,9 +6,23 @@ class CostReportsController < ApplicationController rescue_from Exception do |exception| session.delete(:report) - @custom_errors ||= [] - @custom_errors << l(:error_generic) - render :layout => !request.xhr? + if Rails.env == "production" + @custom_errors ||= [] + @custom_errors << l(:error_generic) + render :layout => !request.xhr? + logger.fatal <<-THE_ERROR + + ============================================================================== + REPORTING ERROR: + + #{exception.class}: #{exception.message} + #{exception.backtrace.join("\n ")} + ============================================================================== + + THE_ERROR + else + raise exception + end end helper :reporting diff --git a/app/helpers/reporting_helper.rb b/app/helpers/reporting_helper.rb index 875f0f14c1..1a5383f540 100644 --- a/app/helpers/reporting_helper.rb +++ b/app/helpers/reporting_helper.rb @@ -1,11 +1,6 @@ module ReportingHelper include QueriesHelper - def l(*values) - return values.first if values.size == 1 and values.first.respond_to? :to_str - super - end - ## # For a given CostQuery::Filter filter, return an array of hashes, that contain # the partials that should be rendered (:name) for that filter and necessary diff --git a/app/models/cost_query/custom_field_mixin.rb b/app/models/cost_query/custom_field_mixin.rb index dc3acb1071..db14ca6686 100644 --- a/app/models/cost_query/custom_field_mixin.rb +++ b/app/models/cost_query/custom_field_mixin.rb @@ -1,5 +1,5 @@ module CostQuery::CustomFieldMixin - include CostQuery::QueryUtils + include Report::QueryUtils attr_reader :custom_field SQL_TYPES = { diff --git a/app/models/cost_query/query_utils.rb b/app/models/cost_query/query_utils.rb index 8766baad20..c3e97d6e3d 100644 --- a/app/models/cost_query/query_utils.rb +++ b/app/models/cost_query/query_utils.rb @@ -14,6 +14,11 @@ module CostQuery::QueryUtils end end + def l(*values) + return values.first if values.size == 1 and values.first.respond_to? :to_str + I18n.t(*values) + end + def user_name(id) # we have no identity map... :( cache[:user_name][id] ||= User.find(id).name