From f8a654a5b6b0123c30c82e98d5a9c1772618b96e Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Fri, 16 Feb 2024 19:44:59 +0200 Subject: [PATCH] reduce error log --- app/controllers/api/api_base_controller.rb | 4 ++-- app/controllers/api/submissions_controller.rb | 4 ++-- app/controllers/application_controller.rb | 2 +- lib/params/base_validator.rb | 2 +- lib/submitters/normalize_values.rb | 2 +- lib/time_utils.rb | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/api/api_base_controller.rb b/app/controllers/api/api_base_controller.rb index 154db075..14f5b82b 100644 --- a/app/controllers/api/api_base_controller.rb +++ b/app/controllers/api/api_base_controller.rb @@ -21,13 +21,13 @@ module Api if Rails.env.production? rescue_from CanCan::AccessDenied do |e| - Rollbar.error(e) if defined?(Rollbar) + Rollbar.warning(e) if defined?(Rollbar) render json: { error: e.message }, status: :forbidden end rescue_from JSON::ParserError do |e| - Rollbar.error(e) if defined?(Rollbar) + Rollbar.warning(e) if defined?(Rollbar) render json: { error: "JSON parse error: #{e.message}" }, status: :unprocessable_entity end diff --git a/app/controllers/api/submissions_controller.rb b/app/controllers/api/submissions_controller.rb index 72e88d96..c71d697d 100644 --- a/app/controllers/api/submissions_controller.rb +++ b/app/controllers/api/submissions_controller.rb @@ -74,7 +74,7 @@ module Api return render json: { error: 'Template not found' }, status: :unprocessable_entity if @template.nil? if @template.fields.blank? - Rollbar.error("Template does not contain fields: #{@template.id}") if defined?(Rollbar) + Rollbar.warning("Template does not contain fields: #{@template.id}") if defined?(Rollbar) return render json: { error: 'Template does not contain fields' }, status: :unprocessable_entity end @@ -94,7 +94,7 @@ module Api render json: submissions.flat_map(&:submitters) rescue Submitters::NormalizeValues::UnknownFieldName, Submitters::NormalizeValues::UnknownSubmitterName => e - Rollbar.error(e) if defined?(Rollbar) + Rollbar.warning(e) if defined?(Rollbar) render json: { error: e.message }, status: :unprocessable_entity end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d7aa782a..19547214 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -24,7 +24,7 @@ class ApplicationController < ActionController::Base if Rails.env.production? rescue_from CanCan::AccessDenied do |e| - Rollbar.error(e) if defined?(Rollbar) + Rollbar.warning(e) if defined?(Rollbar) redirect_to root_path, alert: e.message end diff --git a/lib/params/base_validator.rb b/lib/params/base_validator.rb index 8bdf3a07..cc037300 100644 --- a/lib/params/base_validator.rb +++ b/lib/params/base_validator.rb @@ -9,7 +9,7 @@ module Params validator.call rescue InvalidParameterError => e - Rollbar.error(e) if defined?(Rollbar) + Rollbar.warning(e) if defined?(Rollbar) raise e unless validator.dry_run? rescue StandardError => e diff --git a/lib/submitters/normalize_values.rb b/lib/submitters/normalize_values.rb index a16a51f1..df02d957 100644 --- a/lib/submitters/normalize_values.rb +++ b/lib/submitters/normalize_values.rb @@ -58,7 +58,7 @@ module Submitters value end rescue Date::Error => e - Rollbar.error(e) if defined?(Rollbar) + Rollbar.warning(e) if defined?(Rollbar) value end diff --git a/lib/time_utils.rb b/lib/time_utils.rb index 02b48d8b..4f0d779d 100644 --- a/lib/time_utils.rb +++ b/lib/time_utils.rb @@ -42,7 +42,7 @@ module TimeUtils I18n.l(date, format: i18n_format, locale:) rescue Date::Error => e - Rollbar.error(e) if defined?(Rollbar) + Rollbar.warning(e) if defined?(Rollbar) string end