Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Handle sendgrid bad request (#10949)
Tomasz Szymańskic27cc94d06ff
diff --git a/saleor/plugins/sendgrid/tasks.py b/saleor/plugins/sendgrid/tasks.pyindex 056378fa43..23110ac45f 100644--- a/saleor/plugins/sendgrid/tasks.py+++ b/saleor/plugins/sendgrid/tasks.py@@ -1,5 +1,6 @@import logging+from python_http_client import exceptionsfrom sendgrid import SendGridAPIClient, SendGridExceptionfrom sendgrid.helpers.mail import Mail@@ -24,7 +25,10 @@ def send_email(configuration: SendgridConfiguration, template_id, payload):message = Mail(from_email=from_email, to_emails=recipient_email)message.dynamic_template_data = payloadmessage.template_id = template_id- sendgrid_client.send(message)+ try:+ sendgrid_client.send(message)+ except exceptions.BadRequestsError as e:+ logger.warning("Bad request to Sendgrid, response: %s" % e.body)@app.task(