mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Fix exception reporter
This commit is contained in:
parent
c75e037a5a
commit
f86487f742
2 changed files with 4 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ExceptionReporter
|
class ExceptionReporter
|
||||||
def self.call(exception, human_message = nil)
|
def self.call(exception, human_message = 'Exception reported')
|
||||||
return unless DawarichSettings.self_hosted?
|
return unless DawarichSettings.self_hosted?
|
||||||
|
|
||||||
Rails.logger.error "#{human_message}: #{exception.message}"
|
Rails.logger.error "#{human_message}: #{exception.message}"
|
||||||
|
|
|
||||||
|
|
@ -148,21 +148,21 @@ class Users::ImportData::Trips
|
||||||
|
|
||||||
def validate_trip_name(trip_data)
|
def validate_trip_name(trip_data)
|
||||||
unless trip_data['name'].present?
|
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
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_trip_started_at(trip_data)
|
def validate_trip_started_at(trip_data)
|
||||||
unless trip_data['started_at'].present?
|
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
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_trip_ended_at(trip_data)
|
def validate_trip_ended_at(trip_data)
|
||||||
unless trip_data['ended_at'].present?
|
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
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue