Fix logic for internal server error

* Do not treat werkzeug exceptions as internal server errors
* Added back missing logging

Change-Id: If05ed06e9ba52e27c3c8c3c05cc46cd16170ade0
This commit is contained in:
Dmitry Tantsur 2015-08-28 17:33:29 +02:00
parent b7350242e5
commit f02540ab2c
1 changed files with 4 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import flask
from oslo_config import cfg
from oslo_log import log
from oslo_utils import uuidutils
import werkzeug
from ironic_inspector import db
from ironic_inspector.common.i18n import _, _LC, _LE, _LI, _LW
@ -69,7 +70,10 @@ def convert_exceptions(func):
return func(*args, **kwargs)
except utils.Error as exc:
return error_response(exc, exc.http_code)
except werkzeug.exceptions.HTTPException as exc:
return error_response(exc, exc.code or 400)
except Exception as exc:
LOG.exception(_LE('Internal server error'))
msg = _('Internal server error')
if CONF.debug:
msg += ' (%s): %s' % (exc.__class__.__name__, exc)