Skip to content

Commit

Permalink
rescue get_fairness_json is the service is unreachable
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Mar 21, 2023
1 parent 1cc609b commit 2921f71
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/helpers/fair_score_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ def get_fairness_service_url(apikey = user_apikey)
"#{$FAIRNESS_URL}?portal=#{$HOSTNAME.split('.')[0]}#{apikey.nil? || apikey.empty? ? '' : "&apikey=#{apikey}"}"
end
def get_fairness_json(ontologies_acronyms, apikey = user_apikey)
MultiJson.load(Faraday.get(get_fairness_service_url(apikey) + "&ontologies=#{ontologies_acronyms}&combined").body.force_encoding('ISO-8859-1').encode('UTF-8'))
begin
MultiJson.load(Faraday.get(get_fairness_service_url(apikey) + "&ontologies=#{ontologies_acronyms}&combined").body.force_encoding('ISO-8859-1').encode('UTF-8'))
rescue
Rails.logger.warn "FAIRness service issue unreachable"
{}
end
end

def get_fair_score(ontologies_acronyms, apikey = user_apikey)
Expand Down

0 comments on commit 2921f71

Please sign in to comment.