Hello Simone Tiraboschi,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/27422
to review the following change.
Change subject: Removing useless info line on specific exception
......................................................................
Removing useless info line on specific exception
On an exception it always says
"INFO: Use the -h option to see usage."
but this is not always useful
Change-Id: Ie4ff43555cb8105e27a83ef8dff5b7df42038ae1
Bug-Url: https://bugzilla.redhat.com/1023507
Signed-off-by: Simone Tiraboschi <[email protected]>
---
M src/__main__.py
1 file changed, 12 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-iso-uploader
refs/changes/22/27422/1
diff --git a/src/__main__.py b/src/__main__.py
index 06e3069..4969e6b 100644
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -120,6 +120,13 @@
ARY = [LIST, UPLOAD]
+class NEISODomain(RuntimeError):
+ """"
+ This exception is raised when the user inputs a not existing ISO domain
+ """
+ pass
+
+
class Caller(object):
"""
Utility class for forking programs.
@@ -637,7 +644,7 @@
)
return (sd_uuid, domain_type, address, path)
else:
- raise Exception(
+ raise NEISODomain(
_("An ISO storage domain with a name of %s was not found.") %
isodomain
)
@@ -1430,7 +1437,11 @@
isoup = ISOUploader(conf)
except KeyboardInterrupt, k:
print _("Exiting on user cancel.")
+ except NEISODomain, e:
+ logging.error("%s" % e)
+ sys.exit(ExitCodes.UPLOAD_ERR)
except Exception, e:
+ # FIXME: add better exceptions handling
logging.error("%s" % e)
logging.info(_("Use the -h option to see usage."))
if conf and (conf.get("verbose")):
--
To view, visit http://gerrit.ovirt.org/27422
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4ff43555cb8105e27a83ef8dff5b7df42038ae1
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-iso-uploader
Gerrit-Branch: ovirt-iso-uploader-3.4
Gerrit-Owner: Sandro Bonazzola <[email protected]>
Gerrit-Reviewer: Simone Tiraboschi <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches