Commits

Matthew Schinckel  committed 8cb6c94

Actually use the Gateway.error_format attribute.

  • Participants
  • Parent commits 6bb21f7

Comments (0)

Files changed (1)

File sms/models/gateway.py

         # interim status, which we can get for now, and maybe update later.
         status_msg = res.read()
         logging.debug(status_msg)
-        if status_msg.startswith('ERR') or status_msg.startswith('WARN'):
+        if self.error_format and re.match(self.error_format, status_msg):
+            message.status = "Failed"
+            message.status_message = re.match(self.error_format, status_msg).groupdict()['status_message']
+            logging.warning(message.status_message)
+        elif status_msg.startswith('ERR') or status_msg.startswith('WARN'):
             message.status = "Failed"
             message.status_message = status_msg.split(': ')[1]
+            logging.warning(message.status_message)
         else:
             message.status = "Sent"
             parsed_response = re.match(self.success_format, status_msg).groupdict()