Dan Kenigsberg has posted comments on this change. Change subject: utils: Add unhandled exceptions logging decorator ......................................................................
Patch Set 1: (1 comment) .................................................... File lib/vdsm/utils.py Line 592: try: Line 593: return f(*a, **kw) Line 594: except Exception: Line 595: log = logging.getLogger(on) Line 596: log.exception(msg) Functionally speaking, logged() swallows the exception. It does not do it silently, but program execution continues as if the function never failed, returning None. This is too C-style imo. To prove my point, If main() in your example is an entry point to a script, decorating it with @logged means that the script would always return 0, misleading a even the rare prudent scripter that used `sh -e`. I do not have a short name for "log unhandled exception and return None". That's another reason to re-raise the exception. Line 597: return wrapper Line 598: return decorator Line 599: Line 600: -- To view, visit http://gerrit.ovirt.org/21778 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I39265bac4f26fefa365bad080dafb6106145f846 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <[email protected]> Gerrit-Reviewer: Allon Mureinik <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Daniel Erez <[email protected]> Gerrit-Reviewer: Federico Simoncelli <[email protected]> Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: Saggi Mizrahi <[email protected]> Gerrit-Reviewer: Sergey Gotliv <[email protected]> Gerrit-Reviewer: Vered Volansky <[email protected]> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
