Sha256: 3308aac792e4b7eafb0849edc80c825703abd27d64f80983f01211630fdc53e6
Contents?: true
Size: 759 Bytes
Versions: 19
Compression:
Stored size: 759 Bytes
Contents
# encoding: utf-8 module ProxyTester module Actions class HandleError private attr_reader :exception, :original_message, :handler_klass public def initialize(exception, handler_klass = ErrorHandler) @exception = exception.class @original_message = exception.message @handler_klass = handler_klass end def run handler = handler_klass.find exception handler.original_message = original_message handler.execute(parsed_message) end private def parsed_message result = JSON.parse(original_message) return {} unless result.kind_of? Hash result rescue JSON::ParserError {} end end end end
Version data entries
19 entries across 18 versions & 1 rubygems