Alon Bar-Lev has posted comments on this change.

Change subject: core: Allow returning different return codes
......................................................................


Patch Set 3:

(3 comments)

I do not like the use of exception as it does not allow us to exit code in case 
of success. will think on it a bit more.

http://gerrit.ovirt.org/#/c/26062/3/src/otopi/__main__.py
File src/otopi/__main__.py:

Line 111:                 traceback.print_exc()
Line 112:             raise util.ExitException(
Line 113:                 message=repr(e),
Line 114:                 status=constants.Const.EXIT_STATUS_PLUGIN_LOAD_FAILED
Line 115:             )
exceptions should not be use for normal flow, just have variable of exit code 
within this function.
Line 116:         except Exception as e:
Line 117:             if self._debug > 0:
Line 118:                 print(
Line 119:                     _('FATAL Internal error (main): {error}').format(


Line 129: if __name__ == '__main__':
Line 130:     installer = Installer()
Line 131:     try:
Line 132:         installer.main()
Line 133:     except util.ExitException as e:
no reason to populate this up to here.
Line 134:         sys.exit(e.status)
Line 135:     sys.exit(0)
Line 136: 
Line 137: 


http://gerrit.ovirt.org/#/c/26062/3/src/otopi/util.py
File src/otopi/util.py:

Line 120:         if mod_fobj is not None:
Line 121:             mod_fobj.close()
Line 122: 
Line 123: 
Line 124: class ExitException(Exception):
this should go to plugin.py as it is used by plugins, right?
Line 125:     def __init__(self, message, status):
Line 126:         super(ExitException, self).__init__(message)
Line 127:         self.status = status
Line 128: 


-- 
To view, visit http://gerrit.ovirt.org/26062
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I56e6077f28b876d5358441654a2bedb7330fdd42
Gerrit-PatchSet: 3
Gerrit-Project: otopi
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Sandro Bonazzola <[email protected]>
Gerrit-Reviewer: Yedidyah Bar David <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to