Use einfo.tb when traceback is str
Goal
Celery sometimes calls the failure_handler with a string for the traceback parameter instead of an actual traceback object. This was reported in https://github.com/bugsnag/bugsnag-python/issues/372 (there's a comment on that request from @clr182 which I think has a misunderstanding about what the issue is about). Other users running into the same issue with Celery a long time ago: https://github.com/celery/celery/issues/806 Here's another Celery user with a similar issue more recently, and a similar fix: https://github.com/scoutapp/scout_apm_python/issues/708
Design
Celery should probably be fixed to supply the traceback object in all cases but I haven't had time to dig into that bug. Even if fixed, the old versions of Celery will be used for some time so a workaround in this library seems reasonable.
Changeset
Changed failure_handler to get the traceback object from a different place if the traceback supplied to the function is a string.
Testing
Tested manually. I don't see any existing test cases that are setup to handle the celery integration. Please let me know if I missed these.
Hi @jonls
Thanks for reaching out and raising a PR to fix this issue. We've added this PR to our backlog to be reviewed and will be sure to update you when we have more information.
In the meantime, would you mind adding comments to the newly added code to give some additional context?