lib/hypernova/request_service.rb in hypernova-1.0.0 vs lib/hypernova/request_service.rb in hypernova-1.0.1
- old
+ new
@@ -7,28 +7,28 @@
def render_batch(jobs)
return render_batch_blank(jobs) if jobs.empty?
response_body = Hypernova::ParsedResponse.new(jobs).body
response_body.each do |index_string, resp|
- error(resp["error"], jobs[index_string.to_i]) if resp["error"]
+ on_error(build_error(resp["error"]), jobs[index_string.to_i]) if resp["error"]
end
build_renderer(jobs).render(response_body)
end
def render_batch_blank(jobs)
build_renderer(jobs).render_blank
end
private
- def build_error(name, message)
- Module.const_get(name).new(message)
+ def build_error(error)
+ {
+ 'name' => error['name'],
+ 'message' => error['message'],
+ 'stack' => error['stack'],
+ }
end
def build_renderer(jobs)
Hypernova::BatchRenderer.new(jobs)
- end
-
- def error(error_data, job)
- on_error(build_error(error_data["name"], error_data["message"]), job)
end
end