开发者

Using SUDS Python WSDL client and Django Sentry, Exception with __sentry__ attribute

When using SUDS in a Django app, alongside Sentry error logging, I hit a problem where SUDS raises an error and Sentry tries to handle it, fails horribly and causes a server 500:

[Wed Sep 14 16:06:22 2011] [error] Unable to process log entry: plugin domain (__sentry__), invalid
[Wed Sep 14 16:06:22 2011] [error] Traceback (most recent call last):
[Wed Sep 14 16:06:22 2011] [error]   File "/opt/envs/xxxx/lib/python2.6/site-packages/sentry/client/models.py", line 38, in sentry_exception_handler
[Wed Sep 14 16:06:22 2011] [error]     message_id = get_client().create_from_exception(**extra)
[Wed Sep 14 16:06:22 2011] [error]   File "/opt/envs/xxxx/lib/python2.6/site-packages/sentry/client/base.py", line 220, in create_from_exception
[Wed Sep 14 16:06:22 2011] [error]     frames = varmap(shorten, reporter.get_traceback_frames())
[Wed Sep 14 16:06:22 2011] [error]   File "/opt/envs/xxxx/lib/python2.6/site-packages/sentry/helpers.py", line 68, in varmap
[Wed Sep 14 16:06:22 2011] [error]     ret = [varmap(func, f, context) for f in var]
[Wed Sep 14 16:06:22 2011] [error]   File "/opt/envs/xxxx/lib/python2.6/site-packages/sentry/helpers.py", line 66, in varmap
[Wed Sep 14 16:06:22 2011] [error]     ret = dict((k, varmap(func, v, context)) for k, v in var.iteritems())
[Wed Sep 14 16:06:22 2011] [error]   File "/opt/envs/xxxx/lib/python2.6/site-packages/sentry/helpers.py", line 66, in <genexpr>
[Wed Sep 14 16:06:22 2011] [error]     ret = dict((k, varmap(func, v, context)) for k, v in var.iteritems())
[Wed Sep 14 16:06:22 2011] [error]   File "/opt/envs/xxxx/lib/python2.6/site-packages/sentry/helpers.py", line 68, in varmap
[Wed Sep 14 16:06:22 2011] [error]     ret = [varmap(func, f, context) for f in var]
[Wed Sep 14 16:06:22 2011] [error]   File "/opt/envs/xxxx/lib/python2.6/site-packages/sentry/helpers.py", line 68, in varmap
[Wed Sep 14 16:06:22 2011] [error]     ret = [varmap(func, f, context) for f in var]
[Wed Sep 14 16:06:22 2011] [error]   File "/opt/envs/xxxx/lib/python2.6/site-packages/sentry/helpers.py", line 70, in varmap
[Wed Sep 14 16:06:22 2011] [error]     ret = func(var)
[Wed Sep 14 16:06:22 2011] [error]   File "/opt/envs/xxxx/lib/python2.6/site-packages/sentry/helpers.py", line 235, in shorten
[Wed Sep 14 16:06:22 20开发者_开发百科11] [error]     var = transform(var)
[Wed Sep 14 16:06:22 2011] [error]   File "/opt/envs/xxxx/lib/python2.6/site-packages/sentry/helpers.py", line 101, in transform
[Wed Sep 14 16:06:22 2011] [error]     callable(getattr(value, '__sentry__', None)):
[Wed Sep 14 16:06:22 2011] [error]   File "/opt/envs/xxxx/lib/python2.6/site-packages/suds/plugin.py", line 208, in __getattr__
[Wed Sep 14 16:06:22 2011] [error]     raise Exception, 'plugin domain (%s), invalid' % name
[Wed Sep 14 16:06:22 2011] [error] Exception: plugin domain (__sentry__), invalid

Seems like Sentry and SUDS don't play well...?


Looks like SUDS is actually throwing the incorrect error type in its plugin file, and so Sentry is not able to handle it (Sentry tries to call __sentry__ on the object that raised the exception, and I guess expects an AttributeError to be returned. SUDS just raises an (old-style) Exception...

see: https://fedorahosted.org/suds/browser/trunk/suds/plugin.py#L208

Maybe patch it to raise an AttributeError... but that may not be the best solution... any others?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜