Fix mistakes in Exception() instantiation

This commit is contained in:
Dmitri Bogomolov 2019-10-12 17:12:19 +03:00
parent 5cf8ef06cc
commit c99997dbb9
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 8 additions and 7 deletions

View File

@ -21,6 +21,7 @@ from version import softwareVersion
SMTPDOMAIN = "bmaddr.lan"
LISTENPORT = 8425
class smtpServerChannel(smtpd.SMTPChannel):
def smtp_EHLO(self, arg):
if not arg:
@ -113,9 +114,9 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
try:
sender, domain = p.sub(r'\1', mailfrom).split("@")
if domain != SMTPDOMAIN:
raise Exception("Bad domain %s", domain)
raise Exception("Bad domain %s" % domain)
if sender not in BMConfigParser().addresses():
raise Exception("Nonexisting user %s", sender)
raise Exception("Nonexisting user %s" % sender)
except Exception as err:
logger.debug("Bad envelope from %s: %s", mailfrom, repr(err))
msg_from = self.decode_header("from")
@ -123,9 +124,9 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
msg_from = p.sub(r'\1', self.decode_header("from")[0])
sender, domain = msg_from.split("@")
if domain != SMTPDOMAIN:
raise Exception("Bad domain %s", domain)
raise Exception("Bad domain %s" % domain)
if sender not in BMConfigParser().addresses():
raise Exception("Nonexisting user %s", sender)
raise Exception("Nonexisting user %s" % sender)
except Exception as err:
logger.error("Bad headers from %s: %s", msg_from, repr(err))
return
@ -145,7 +146,7 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
try:
rcpt, domain = p.sub(r'\1', to).split("@")
if domain != SMTPDOMAIN:
raise Exception("Bad domain %s", domain)
raise Exception("Bad domain %s" % domain)
logger.debug("Sending %s to %s about %s", sender, rcpt, msg_subject)
self.send(sender, rcpt, msg_subject, body)
logger.info("Relayed %s to %s", sender, rcpt)

View File

@ -258,7 +258,7 @@ class namecoinConnection(object):
resp = self.con.getresponse()
result = resp.read()
if resp.status != 200:
raise Exception("Namecoin returned status %i: %s" % resp.status, resp.reason)
raise Exception("Namecoin returned status %i: %s" % (resp.status, resp.reason))
except:
logger.info("HTTP receive error")
except:
@ -288,7 +288,7 @@ class namecoinConnection(object):
return result
except socket.error as exc:
raise Exception("Socket error in RPC connection: %s" % str(exc))
raise Exception("Socket error in RPC connection: %s" % exc)
def lookupNamecoinFolder():