From 2ac7b572e8043fe711796ee6222cd588494212ea Mon Sep 17 00:00:00 2001 From: "kuldeep.k@cisinlabs.com" Date: Tue, 31 Aug 2021 22:23:37 +0530 Subject: [PATCH] Added SmtpServerChannelException custom exception --- src/class_smtpServer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/class_smtpServer.py b/src/class_smtpServer.py index c84461ba..f5b63c2e 100644 --- a/src/class_smtpServer.py +++ b/src/class_smtpServer.py @@ -28,6 +28,11 @@ logger = logging.getLogger('default') # pylint: disable=attribute-defined-outside-init +class SmtpServerChannelException(Exception): + """Generic smtp server channel exception.""" + pass + + class smtpServerChannel(smtpd.SMTPChannel): """Asyncore channel for SMTP protocol (server)""" def smtp_EHLO(self, arg): @@ -54,7 +59,7 @@ class smtpServerChannel(smtpd.SMTPChannel): self.auth = True self.push('235 2.7.0 Authentication successful') else: - raise Exception("Auth fail") + raise SmtpServerChannelException("Auth fail") except: # noqa:E722 self.push('501 Authentication fail')