1
# Copyright 2013 VMware, Inc
3
# Licensed under the Apache License, Version 2.0 (the "License"); you may
4
# not use this file except in compliance with the License. You may obtain
5
# a copy of the License at
7
# http://www.apache.org/licenses/LICENSE-2.0
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
# License for the specific language governing permissions and limitations
15
from neutron.common import exceptions
18
class VcnsException(exceptions.NeutronException):
22
class VcnsGeneralException(VcnsException):
23
def __init__(self, message):
24
self.message = message
25
super(VcnsGeneralException, self).__init__()
28
class VcnsBadRequest(exceptions.BadRequest):
32
class VcnsNotFound(exceptions.NotFound):
33
message = _('%(resource)s not found: %(msg)s')
36
class VcnsApiException(VcnsException):
37
message = _("An unknown exception %(status)s occurred: %(response)s.")
39
def __init__(self, **kwargs):
40
super(VcnsApiException, self).__init__(**kwargs)
42
self.status = kwargs.get('status')
43
self.header = kwargs.get('header')
44
self.response = kwargs.get('response')
47
class ResourceRedirect(VcnsApiException):
48
message = _("Resource %(uri)s has been redirected")
51
class RequestBad(VcnsApiException):
52
message = _("Request %(uri)s is Bad, response %(response)s")
55
class Forbidden(VcnsApiException):
56
message = _("Forbidden: %(uri)s")
59
class ResourceNotFound(VcnsApiException):
60
message = _("Resource %(uri)s not found")
63
class MediaTypeUnsupport(VcnsApiException):
64
message = _("Media Type %(uri)s is not supported")
67
class ServiceUnavailable(VcnsApiException):
68
message = _("Service Unavailable: %(uri)s")