Fix exception reporter

This commit is contained in:
Eugene Burmakin 2025-06-30 23:54:45 +02:00
parent c75e037a5a
commit f86487f742
2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
class ExceptionReporter
def self.call(exception, human_message = nil)
def self.call(exception, human_message = 'Exception reported')
return unless DawarichSettings.self_hosted?
Rails.logger.error "#{human_message}: #{exception.message}"

View file

@ -148,21 +148,21 @@ class Users::ImportData::Trips
def validate_trip_name(trip_data)
unless trip_data['name'].present?
ExceptionReporter.call(e, 'Failed to create trip: Validation failed: Name can\'t be blank')
Rails.logger.error 'Failed to create trip: Validation failed: Name can\'t be blank'
return false
end
end
def validate_trip_started_at(trip_data)
unless trip_data['started_at'].present?
ExceptionReporter.call(e, 'Failed to create trip: Validation failed: Started at can\'t be blank')
Rails.logger.error 'Failed to create trip: Validation failed: Started at can\'t be blank'
return false
end
end
def validate_trip_ended_at(trip_data)
unless trip_data['ended_at'].present?
ExceptionReporter.call(e, 'Failed to create trip: Validation failed: Ended at can\'t be blank')
Rails.logger.error 'Failed to create trip: Validation failed: Ended at can\'t be blank'
return false
end
end