debug for notify-admin-1588

This commit is contained in:
Kenneth Kehl
2024-06-05 12:42:35 -07:00
parent 403c5815f0
commit 920d2c4539
8 changed files with 39 additions and 17 deletions

View File

@@ -13,7 +13,7 @@ from app.dao.provider_details_dao import get_provider_details_by_notification_ty
from app.enums import BrandType, KeyType, NotificationStatus, NotificationType
from app.exceptions import NotificationTechnicalFailureException
from app.serialised_models import SerialisedService, SerialisedTemplate
from app.utils import utc_now
from app.utils import hilite, scrub, utc_now
from notifications_utils.template import (
HTMLEmailTemplate,
PlainTextEmailTemplate,
@@ -109,15 +109,19 @@ def send_sms_to_provider(notification):
"international": notification.international,
}
db.session.close() # no commit needed as no changes to objects have been made above
current_app.logger.info("sending to sms")
message_id = provider.send_sms(**send_sms_kwargs)
current_app.logger.info(f"got message_id {message_id}")
except Exception as e:
current_app.logger.error(e)
msg = f"FAILED sending message for this recipient: {recipient} to sms"
current_app.logger.error(hilite(scrub(f"{msg} {e}")))
notification.billable_units = template.fragment_count
dao_update_notification(notification)
raise e
else:
msg = f"Sending message for this recipient: {recipient} to sms"
current_app.logger.info(hilite(scrub(msg)))
notification.billable_units = template.fragment_count
update_notification_to_sending(notification, provider)
return message_id