summaryrefslogtreecommitdiff
path: root/lib/model.rb
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-02-07 15:35:53 +0100
committermguetlein <martin.guetlein@gmail.com>2011-02-07 15:35:53 +0100
commit281a0bade2ca1d1bb040c54704650b69f6da24a5 (patch)
treef2ffd62955b2957bb63c33440d2cc887826a0d34 /lib/model.rb
parent9848197e9e0830c569ae2addcd404c59c0a53180 (diff)
.find method raises error if opentox-object not found, extending validation.rb
Diffstat (limited to 'lib/model.rb')
-rw-r--r--lib/model.rb11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/model.rb b/lib/model.rb
index 7cf52ad..ae793e8 100644
--- a/lib/model.rb
+++ b/lib/model.rb
@@ -24,18 +24,15 @@ module OpenTox
class Generic
include Model
- # Find Generic Opentox Model via URI, and loads metadata
+ # Find Generic Opentox Model via URI, and loads metadata, could raise NotFound/NotAuthorized error
# @param [String] uri Model URI
- # @return [OpenTox::Model::Generic] Model instance, nil if model was not found
+ # @return [OpenTox::Model::Generic] Model instance
def self.find(uri,subjectid=nil)
return nil unless uri
model = Generic.new(uri)
model.load_metadata(subjectid)
- if model.metadata==nil or model.metadata.size==0
- nil
- else
- model
- end
+ raise "could not load model metadata" if model.metadata==nil or model.metadata.size==0
+ model
end
# provides feature type, possible types are "regression" or "classification"