tashi-client: convert "unknown user" to a TashiException
tashi-client: print out nicer messages on exceptions - comment again for better debugging
git-svn-id: https://svn.apache.org/repos/asf/incubator/tashi/trunk@1355162 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/tashi/client/tashi-client.py b/src/tashi/client/tashi-client.py
index c3f23f0..d1e811b 100755
--- a/src/tashi/client/tashi-client.py
+++ b/src/tashi/client/tashi-client.py
@@ -50,7 +50,7 @@
for user in users:
if (users[user].name == userStr):
return users[user].id
- raise ValueError("Unknown user %s" % (userStr))
+ raise TashiException({'msg':"Unknown user %s" % (userStr)})
def checkHid(host):
userId = getUser()
@@ -665,15 +665,12 @@
except Exception, e:
print e
except TashiException, e:
- print "TashiException:"
+ print "A Tashi exception occurred""
print e.msg
exitCode = e.errno
-# except Exception, e:
-# print e
- # XXXstroucki: exception may be unrelated to usage of function
- # so don't print usage on exception as if there were a problem
- # with the arguments
- #usage(function)
+ except Exception, e:
+ print "A general exception occurred"
+ print e
sys.exit(exitCode)
if __name__ == "__main__":