From f3d6c7ec1ff01dd8d060424afd9ab5295cc7fea5 Mon Sep 17 00:00:00 2001 From: rautenberg Date: Tue, 4 Nov 2014 17:14:21 +0100 Subject: add rescue to .features and .compounds methods to make them work with A&A (it do not work if dataset do not exists) --- lib/dataset.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/dataset.rb b/lib/dataset.rb index 5b08110..ce5fc07 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -34,7 +34,11 @@ module OpenTox def features force_update=false if @features.empty? or force_update uri = File.join(@uri,"features") - uris = RestClientWrapper.get(uri,{},{:accept => "text/uri-list"}).split("\n") # ordered datasets return ordered features + begin + uris = RestClientWrapper.get(uri,{},{:accept => "text/uri-list"}).split("\n") # ordered datasets return ordered features + rescue + uris = [] + end @features = uris.collect{|uri| Feature.new(uri)} end @features @@ -44,7 +48,11 @@ module OpenTox def compounds force_update=false if @compounds.empty? or force_update uri = File.join(@uri,"compounds") - uris = RestClientWrapper.get(uri,{},{:accept => "text/uri-list"}).split("\n") # ordered datasets return ordered compounds + begin + uris = RestClientWrapper.get(uri,{},{:accept => "text/uri-list"}).split("\n") # ordered datasets return ordered compounds + rescue + uris = [] + end @compounds = uris.collect{|uri| Compound.new(uri)} end @compounds -- cgit v1.2.3