Change in vdsm[master]: WIP: POC: virt: common handling of exception
fromani at redhat.com
fromani at redhat.com
Tue Mar 15 16:16:32 UTC 2016
Francesco Romani has posted comments on this change.
Change subject: WIP: POC: virt: common handling of exception
......................................................................
Patch Set 1:
(3 comments)
thanks for the reminders, I missed the comments before.
https://gerrit.ovirt.org/#/c/54664/1/lib/vdsm/virt/utils.py
File lib/vdsm/virt/utils.py:
Line 31: from vdsm import exception
Line 32: from vdsm import response
Line 33:
Line 34:
Line 35: def api_method(func):
> I would put this into virt.api module, this is not yet another utility.
Good idea, done.
Line 36: @wraps(func)
Line 37: def wrapper(*args, **kwargs):
Line 38: try:
Line 39: ret = func(*args, **kwargs)
Line 33:
Line 34:
Line 35: def api_method(func):
Line 36: @wraps(func)
Line 37: def wrapper(*args, **kwargs):
> Since this is a method wrapper, best use:
Let's try this
Line 38: try:
Line 39: ret = func(*args, **kwargs)
Line 40: except exception.VdsmException as e:
Line 41: return e.response()
Line 42: else:
Line 43: if ret is not None:
Line 44: return response.success(**ret)
Line 45: else:
Line 46: return response.success()
> Few improvments:
Good ideas, implemented. I also added logging of kwargs,
Line 47:
Line 48: return wrapper
Line 49:
Line 50:
--
To view, visit https://gerrit.ovirt.org/54664
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic186dc8fa062d8b3789c6057bba68fbbc23f311b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Amit Aviram <aaviram at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list