We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f4920c2 commit f5ee65fCopy full SHA for f5ee65f
1 file changed
postmark/core.py
@@ -470,8 +470,13 @@ def send(self, test=None):
470
jsontxt = err.read().decode()
471
jsonobj = json.loads(jsontxt)
472
desc = jsonobj['Message']
473
- except:
474
- desc = 'Description not given'
+ error_code = jsonobj['ErrorCode']
+ except KeyError:
475
+ raise PMMailUnprocessableEntityException('Unprocessable Entity: Description not given')
476
+
477
+ if error_code == 406:
478
+ raise PMMailInactiveRecipientException('You tried to send email to a recipient that has been marked as inactive.')
479
480
raise PMMailUnprocessableEntityException('Unprocessable Entity: %s' % desc)
481
elif err.code == 500:
482
raise PMMailServerErrorException('Internal server error at Postmark. Admins have been alerted.', err)
0 commit comments