Commits

Charlie Penner  committed 2ae0f2e

throw mercurial Abort error instead of a general python Exception

  • Participants
  • Parent commits 92e1f46

Comments (0)

Files changed (1)

File commitsigs.py

     p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
     sig = p.communicate(msg)[0]
     if p.returncode:
-        raise Exception("Failed to generate signature for user '%s'" % user if user else "not given")
+        raise error.Abort("Failed to generate signature for user '%s'" % user if user else "not given")
     return binascii.b2a_base64(sig).strip()
 
 
 def checkTrustLevel(requiredTrust, actualTrust):
     if not requiredTrust in gpgTrustLevels :
-        raise Exception("Unrecognzied required trust level '%s'." % requiredTrust)
+        raise error.Abort("Unrecognzied required trust level '%s'." % requiredTrust)
     if not actualTrust in gpgTrustLevels :
-        raise Exception("Unrecognized actual trust level '%s'." % actualTrust)
+        raise error.Abort("Unrecognized actual trust level '%s'." % actualTrust)
     return gpgTrustLevels[requiredTrust] <= gpgTrustLevels[actualTrust]
 
 def gnupgverify(msg, sig, quiet=False, user=None):