mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
Backend: fix exception messaging
This commit is contained in:
@@ -8,19 +8,19 @@ import requests
|
|||||||
|
|
||||||
class DjrillBackendHTTPError(Exception):
|
class DjrillBackendHTTPError(Exception):
|
||||||
"""An exception that will turn into an HTTP error response."""
|
"""An exception that will turn into an HTTP error response."""
|
||||||
def __init__(self, status_code, log_message=None, *args):
|
def __init__(self, status_code, log_message=None):
|
||||||
|
super(DjrillBackendHTTPError, self).__init__()
|
||||||
self.status_code = status_code
|
self.status_code = status_code
|
||||||
self.log_message = log_message
|
self.log_message = log_message
|
||||||
self.args = args
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
message = "DjrillBackendHTTP %d: %s" % (
|
message = "DjrillBackendHTTP %d" % self.status_code
|
||||||
self.status_code, httplib.responses[self.status_code])
|
|
||||||
if self.log_message:
|
if self.log_message:
|
||||||
return message + " (" + (self.log_message % self.args) + ")"
|
return message + " " + self.log_message
|
||||||
else:
|
else:
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
|
||||||
class DjrillBackend(BaseEmailBackend):
|
class DjrillBackend(BaseEmailBackend):
|
||||||
"""
|
"""
|
||||||
Mandrill API Email Backend
|
Mandrill API Email Backend
|
||||||
|
|||||||
Reference in New Issue
Block a user