Add mogan exceptions

Change-Id: I9daac6a0c219d2c71bd734e9a0bb46ca49721783
This commit is contained in:
Zhenguo Niu 2017-05-08 14:40:44 +08:00
parent 01bcae5fcd
commit 7e7fe5ccde
2 changed files with 30 additions and 0 deletions

View File

@ -12,6 +12,8 @@
from django.utils.translation import ugettext_lazy as _
from mogan_ui import exceptions
# The slug of the panel group to be added to HORIZON_CONFIG. Required.
PANEL_GROUP = 'baremetal_compute'
# The display name of the PANEL_GROUP. Required.
@ -20,3 +22,8 @@ PANEL_GROUP_NAME = _('Bare Metal Compute')
PANEL_GROUP_DASHBOARD = 'project'
ADD_INSTALLED_APPS = ['mogan_ui']
ADD_EXCEPTIONS = {
'recoverable': exceptions.RECOVERABLE,
'not_found': exceptions.NOT_FOUND,
'unauthorized': exceptions.UNAUTHORIZED,
}

23
mogan_ui/exceptions.py Normal file
View File

@ -0,0 +1,23 @@
# Licensed 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.
from moganclient.common import exceptions as exc
from openstack_dashboard import exceptions
NOT_FOUND = exceptions.NOT_FOUND + (exc.NotFound,)
UNAUTHORIZED = exceptions.UNAUTHORIZED + (exc.Unauthorized,)
RECOVERABLE = exceptions.RECOVERABLE + (
exc.Forbidden, exc.HttpError
)
ResourceNotFound = exc.NotFound