Class: Weeloy::ErrorMessages
- Inherits:
-
Object
- Object
- Weeloy::ErrorMessages
- Defined in:
- app/services/weeloy/error_messages.rb
Constant Summary collapse
- DEFAULT_ERROR =
'Sorry, something went wrong'- SUPPLIER_ERROR =
'Supplier Error:'- UNAVAILABILITY_ERROR =
list of error messages from Weeloy API
'No tables are available for current selection.'- TIME_HAS_PASSED =
'Selected time occurs in the past.'- CANNOT_UPDATE_CANCELED_RESERVATION_ERROR =
'Sorry, you cannot modify the status of a CANCELED reservation in Weeloy'- CANNOT_UPDATE_STATUS_ON_HUNGRYHUB_ERROR =
'Sorry, the status of this reservation can only be changed from the Weeloy dashboard'- BLOCKAGE_EXPIRED_UPDATE_ERROR =
'Block could not be updated'- ERROR_MESSAGE_MAP =
map of error messages from Weeloy API to HungryHub error messages
{ UNAVAILABILITY_ERROR => I18n.t('inventory.not_available'), TIME_HAS_PASSED => I18n.t('inventory.time_has_passed'), }.freeze
- KNOWN_ERRORS =
list of error messages from Weeloy API that should not be logged
ERROR_MESSAGE_MAP.keys.freeze
- INVENTORY_ERRORS =
list of inventory errors
[UNAVAILABILITY_ERROR, TIME_HAS_PASSED].freeze
Class Method Summary collapse
-
.error_message(actor, error) ⇒ String
Returns the error message based on the actor and error code.
Class Method Details
.error_message(actor, error) ⇒ String
Returns the error message based on the actor and error code.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/services/weeloy/error_messages.rb', line 35 def self.(actor, error) return DEFAULT_ERROR if actor.blank? || error.blank? if actor.to_sym == :user ERROR_MESSAGE_MAP[error] || DEFAULT_ERROR else return "#{SUPPLIER_ERROR} #{ERROR_MESSAGE_MAP[error]}" if ERROR_MESSAGE_MAP[error].present? "#{SUPPLIER_ERROR} #{error}" end end |