fix error message when resource not found

Depends-On: I428d04598910edfe67e8b8deb608bcf1233d672d
Change-Id: I65dc70c3fa2fd7083bbabf6af47907b01fb93ebb
This commit is contained in:
Eyal 2017-12-13 10:10:19 +02:00
parent 7ddedcc31f
commit dbedd6b651

View File

@ -76,11 +76,7 @@ class ResourcesController(RootRestController):
pecan.request.enforcer,
{})
try:
return self._show_resource(vitrage_id)
except Exception as e:
LOG.exception('failed to show resource %s, %s' % vitrage_id, e)
abort(404, str(e))
@staticmethod
def _show_resource(vitrage_id):
@ -89,7 +85,11 @@ class ResourcesController(RootRestController):
pecan.request.context,
'show_resource',
vitrage_id=vitrage_id)
LOG.info(resource)
if not resource:
abort(404, "Failed to find resource %s" % vitrage_id)
LOG.debug('resource found = %s', resource)
return json.loads(resource)
except Exception as e:
LOG.exception('failed to show resource with vitrage_id(%s),'