diff options
author | rautenberg <rautenberg@in-silico.ch> | 2014-11-04 17:14:21 +0100 |
---|---|---|
committer | rautenberg <rautenberg@in-silico.ch> | 2014-11-04 17:14:21 +0100 |
commit | f3d6c7ec1ff01dd8d060424afd9ab5295cc7fea5 (patch) | |
tree | 8a623bc3e1c17570adaa64454ce9b9fd4a77e8f7 /lib | |
parent | 589137fc4bd8ddeebaecad5a1e498048fb52046f (diff) |
add rescue to .features and .compounds methods to make them work with A&A (it do not work if dataset do not exists)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dataset.rb | 12 |
1 files 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 |