Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4CF059765 for ; Wed, 30 Nov 2011 15:20:00 +0000 (UTC) Received: (qmail 64062 invoked by uid 500); 30 Nov 2011 15:20:00 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 64047 invoked by uid 500); 30 Nov 2011 15:20:00 -0000 Mailing-List: contact dev-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list dev@deltacloud.apache.org Received: (qmail 64039 invoked by uid 99); 30 Nov 2011 15:20:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Nov 2011 15:20:00 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Nov 2011 15:19:53 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pAUFJWh1024336 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 30 Nov 2011 10:19:32 -0500 Received: from dhcp-29-121.brq.redhat.com (dhcp-29-121.brq.redhat.com [10.34.29.121]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pAUFJVe1028203 for ; Wed, 30 Nov 2011 10:19:32 -0500 From: mfojtik@redhat.com To: dev@deltacloud.apache.org Subject: [PATCH core 1/2] CIMI: Moved exceptions to a separate file Date: Wed, 30 Nov 2011 16:20:39 +0100 Message-Id: <1322666440-86035-1-git-send-email-mfojtik@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 From: Michal Fojtik Signed-off-by: Michal fojtik --- 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