From: Michal Fojtik <[email protected]>
Signed-off-by: Michal fojtik <[email protected]> --- server/lib/cimi/model.rb | 1 + server/lib/cimi/model/base.rb | 8 ------- server/lib/cimi/model/errors.rb | 40 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 server/lib/cimi/model/errors.rb diff --git a/server/lib/cimi/model.rb b/server/lib/cimi/model.rb index 243f693..d98c2af 100644 --- a/server/lib/cimi/model.rb +++ b/server/lib/cimi/model.rb @@ -22,6 +22,7 @@ end require 'cimi/model/schema' require 'cimi/model/base' +require 'cimi/model/errors' require 'cimi/model/cloud_entry_point' require 'cimi/model/machine_template' require 'cimi/model/machine_image' diff --git a/server/lib/cimi/model/base.rb b/server/lib/cimi/model/base.rb index ddc1b8a..53ed3c1 100644 --- a/server/lib/cimi/model/base.rb +++ b/server/lib/cimi/model/base.rb @@ -67,14 +67,6 @@ require 'json' # An array of structured subobjects; the block defines the schema of # the subobjects. -class CIMI::Model::NotFound < StandardError - attr_accessor :code - def initialize - super("Requested Entity Not Found") - self.code = 404 - end -end - module CIMI::Model def self.register_as_root_entity!(name) diff --git a/server/lib/cimi/model/errors.rb b/server/lib/cimi/model/errors.rb new file mode 100644 index 0000000..9fb82f1 --- /dev/null +++ b/server/lib/cimi/model/errors.rb @@ -0,0 +1,40 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +module CIMI::Model + + class NotFound < StandardError + attr_accessor :code + + def initialize + super("Requested Entity Not Found") + self.code = 404 + end + + end + + class NotImplemented < StandardError + attr_accessor :code + + def initialize + super("Requested operation is not implemented by backend provider") + self.code = 501 + end + + end + +end + + -- 1.7.4.4
