Class: Hash
Constant Summary
collapse
- MATCH_ID_KEY =
'match_id'
Instance Method Summary
collapse
#delete_state!, #handle_exception, #match_instance, #save_match_instance
Instance Method Details
#retrieve_match_id_or_raise_exception ⇒ Object
86
87
88
|
# File 'lib/background/worker_helpers.rb', line 86
def retrieve_match_id_or_raise_exception
retrieve_parameter_or_raise_exception MATCH_ID_KEY
end
|
#retrieve_parameter_or_raise_exception(parameter_key) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/background/worker_helpers.rb', line 70
def retrieve_parameter_or_raise_exception(parameter_key)
retrieved_param = self[parameter_key]
unless retrieved_param
error_message = StandardError.new("No #{parameter_key.to_english} provided.")
if self[MATCH_ID_KEY]
WorkerHelpers.handle_exception self['match_id'], error_message
else
WorkerHelpers.log_message error_message
end
raise
end
retrieved_param
end
|