diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-02-07 15:35:53 +0100 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-02-07 15:35:53 +0100 |
commit | 281a0bade2ca1d1bb040c54704650b69f6da24a5 (patch) | |
tree | f2ffd62955b2957bb63c33440d2cc887826a0d34 /lib/algorithm.rb | |
parent | 9848197e9e0830c569ae2addcd404c59c0a53180 (diff) |
.find method raises error if opentox-object not found, extending validation.rb
Diffstat (limited to 'lib/algorithm.rb')
-rw-r--r-- | lib/algorithm.rb | 11 |
1 files changed, 4 insertions, 7 deletions
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 |