sms: do not record errors for application-level errors (#65330) #466

Merged
fpeters merged 1 commits from wip/65330-sms-error-log into main 2023-07-14 09:04:07 +02:00
1 changed files with 4 additions and 2 deletions

View File

@ -40,9 +40,11 @@ class PasserelleSMS:
app_error_code = None
if status == 200:
app_error_code = get_app_error_code(response, data, 'json')
if status != 200 or app_error_code:
result = 'success' if (status == 200 and not app_error_code) else 'error'
get_logger().debug('sms (to: %r): %s', destinations, result)
else:
get_logger().warning('sms (to: %r): error %s', destinations, status)
raise SMSError()
get_logger().debug('sms %r sent using passerelle to %r, result: %r', text, destinations, data)
class SMS: