Closed philfreo closed 8 years ago
Any ideas?
You're right. traceback.format_exception_only
returns an array of strings, not a string. The right code would be:
except requests.exceptions.RequestException as e:
warnings.warn('Failed to track event: %s' % properties)
lines = traceback.format_exception_only(type(e), e)
for line in lines:
warnings.warn(line)
I'm not sure that the stack trace is useful in this case, so I think omitting it is best. That is, just removed the additional logging and leaving the warning about the failure to track the event.
I'm working on a fix.
Wouldn't having the stack trace help show where in the codebase the problem is / which usage of Sift is causing the problem?
Yes, that's true. Usually in the case of exception, however, missing an event here or there isn't detrimental. In the degenerate case, it could spam the logs. That said, your comment is a good one and I'll make the change with the stack trace printed.
@philfreo Please see version 1.1.2.3
Thanks, will give it a shot!
I'm seeing some TypeError exceptions, it seems that the new warnings / exception handling code has some issues?
Not sure exactly how/when/why this happens but it seems that the Sift responses aren't always handled properly.
/cc @JohnMcSpedon @fredsadaghiani