lib/grumlin/request_dispatcher.rb in grumlin-0.8.0 vs lib/grumlin/request_dispatcher.rb in grumlin-0.9.0

- old
+ new

@@ -42,11 +42,11 @@ request_id = response[:requestId] raise "ERROR" unless ongoing_request?(request_id) request = @requests[request_id] - check_errors!(response[:status]) + check_errors!(response[:status], request[:request]) case SUCCESS[response.dig(:status, :code)] when :success request[:channel] << [*request[:result], response.dig(:result, :data)] close_request(request_id) @@ -75,12 +75,12 @@ @requests.clear end private - def check_errors!(status) + def check_errors!(status, query) if (error = ERRORS[status[:code]]) - raise(error, status) + raise error.new(status, query) end return unless SUCCESS[status[:code]].nil? raise(UnknownResponseStatus, status)