module Tradesman::ErrorHandling
Public Instance Methods
expected_errors_map()
click to toggle source
# File lib/tradesman/error_handling.rb, line 13 def expected_errors_map expected_tzu_errors_map.merge(expected_horza_errors_map) end
expected_horza_errors_map()
click to toggle source
# File lib/tradesman/error_handling.rb, line 24 def expected_horza_errors_map { Horza::Errors::RecordNotFound => Tradesman::RecordNotFound, Horza::Errors::RecordInvalid => Tradesman::RecordInvalid, Horza::Errors::UnknownAttributeError => Tradesman::UnknownAttributeError } end
expected_tzu_errors_map()
click to toggle source
# File lib/tradesman/error_handling.rb, line 17 def expected_tzu_errors_map { Tzu::Invalid => Tradesman::Invalid, Tzu::Failure => Tradesman::Failure, } end
run_and_convert_exceptions(&block)
click to toggle source
# File lib/tradesman/error_handling.rb, line 3 def run_and_convert_exceptions(&block) block.call rescue *expected_errors_map.keys => e raise tradesman_error_from_gem_error(e.class).new(e.message) end
tradesman_error_from_gem_error(gem_error)
click to toggle source
# File lib/tradesman/error_handling.rb, line 9 def tradesman_error_from_gem_error(gem_error) expected_errors_map[gem_error] end