sendgrid / python-http-client

Twilio SendGrid's Python HTTP Client for calling APIs
https://sendgrid.com
MIT License
126 stars 101 forks source link

pickle / celery breaks with exceptions #139

Closed syphar closed 3 years ago

syphar commented 4 years ago

Issue Summary

We are using this library in a celery background task, using celery. (through the sendgrid library, and actually django-celery-email).

When errors happen with the sendgrid API (like a BAD REQUEST), celery can handle this exception and normally pickle it to return it to the caller.

Currently we are seeing a PicklingError where the exception type from this library can be pickled.

As seen in this issue the problem is that in the custom exception types super() is not called.

Exception/Log

line breaks added for readability

ERROR [none] celery.worker.request: 
Task handler raised error: <MaybeEncodingError: Error sending result: 
''(1, <ExceptionInfo: BadRequestsError("<HTTPError 400: \'Bad Request\'>",)>, None)''. 
Reason: ''PicklingError("Can\'t pickle 
<class \'python_http_client.exceptions.BadRequestsError\'>: it\'s not 
the same object as python_http_client.exceptions.BadRequestsError",)''.>

Technical details:

childish-sambino commented 4 years ago

This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.

wmai commented 4 years ago

+1

oldani commented 4 years ago

+1

caelean commented 4 years ago

+1

childish-sambino commented 4 years ago

+1s on the issue summary

We don't track +1s on comments.