Commit 1765b262 by source_reader

added logging to joule backend errors

parent e78b62d0
Showing with 20 additions and 6 deletions
...@@ -20,19 +20,27 @@ module Joule ...@@ -20,19 +20,27 @@ module Joule
def dbinfo def dbinfo
begin begin
resp = self.class.get("#{@url}/version") resp = self.class.get("#{@url}/version")
return nil unless resp.success? if not resp.success?
Rails.logger.warn "Error retrieving /version for #{@url}: [#{resp.body}]"
return nil
end
version = resp.parsed_response version = resp.parsed_response
resp = self.class.get("#{@url}/dbinfo") resp = self.class.get("#{@url}/dbinfo")
return nil unless resp.success? if not resp.success?
Rails.logger.warn "Error retrieving /dbinfo for #{@url}: [#{resp.body}]"
return nil
end
info = resp.parsed_response info = resp.parsed_response
rescue rescue StandardError => e
Rails.logger.warn "Error retrieving dbinfo for #{@url}: [#{e}]"
return nil return nil
end end
# if the site exists but is not a nilm... # if the site exists but is not a nilm...
required_keys = %w(size other free reserved) required_keys = %w(size other free reserved)
unless info.respond_to?(:has_key?) && unless info.respond_to?(:has_key?) &&
required_keys.all? { |s| info.key? s } required_keys.all? { |s| info.key? s }
Rails.logger.warn "Error #{@url} is not a Joule node"
return nil return nil
end end
{ {
...@@ -47,7 +55,8 @@ module Joule ...@@ -47,7 +55,8 @@ module Joule
begin begin
resp = self.class.get("#{@url}/streams.json") resp = self.class.get("#{@url}/streams.json")
return nil unless resp.success? return nil unless resp.success?
rescue rescue StandardError => e
Rails.logger.warn "Error retrieving db_schema for #{@url}: [#{e}]"
return nil return nil
end end
resp.parsed_response.deep_symbolize_keys resp.parsed_response.deep_symbolize_keys
...@@ -61,11 +70,16 @@ module Joule ...@@ -61,11 +70,16 @@ module Joule
# if the site exists but is not a joule server... # if the site exists but is not a joule server...
required_keys = %w(name inputs outputs) required_keys = %w(name inputs outputs)
items.each do |item| items.each do |item|
return nil unless item.respond_to?(:has_key?) && unless item.respond_to?(:has_key?) &&
required_keys.all? { |s| item.key? s } required_keys.all? { |s| item.key? s }
Rails.logger.warn "Error #{@url} is not a Joule node"
return nil
end
item.symbolize_keys! item.symbolize_keys!
end end
rescue
rescue StandardError => e
Rails.logger.warn "Error retrieving module_schemas for #{@url}: [#{e}]"
return nil return nil
end end
items items
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment