From 281a0bade2ca1d1bb040c54704650b69f6da24a5 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Mon, 7 Feb 2011 15:35:53 +0100 Subject: .find method raises error if opentox-object not found, extending validation.rb --- lib/algorithm.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'lib/algorithm.rb') diff --git a/lib/algorithm.rb b/lib/algorithm.rb index bfa9860..af8dfaf 100644 --- a/lib/algorithm.rb +++ b/lib/algorithm.rb @@ -31,18 +31,15 @@ module OpenTox class Generic include Algorithm - # Find Generic Opentox Algorithm via URI, and loads metadata + # Find Generic Opentox Algorithm via URI, and loads metadata, could raise NotFound/NotAuthorized error # @param [String] uri Algorithm URI - # @return [OpenTox::Algorithm::Generic] Algorithm instance, nil if alogrithm was not found + # @return [OpenTox::Algorithm::Generic] Algorithm instance def self.find(uri, subjectid=nil) return nil unless uri alg = Generic.new(uri) alg.load_metadata( subjectid ) - if alg.metadata==nil or alg.metadata.size==0 - nil - else - alg - end + raise "cannot load algorithm metadata" if alg.metadata==nil or alg.metadata.size==0 + alg end end -- cgit v1.2.3