Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

web.py and wsgi problem #351

@Katafalkas

Description

@Katafalkas

Hey,
So we are trying to wrap raven.middleware around our WSGI application. The problem is that when we do - raven still does not send exceptions to Sentry. raven test worked fine, so we are sure there is a connection to Sentry server.I did some debugging in raven.middleware and found out that our web.py WSGI application does not trigger any of the cases that call self.handle_exception(environ). I did slight modification on the call method:

def __call__(self, environ, start_response):
        try:
        iterable = self.application(environ, start_response)
        except Exception:
            self.handle_exception(environ)
            raise

        try:
            for event in iterable:
                yield event
        except Exception:
            self.handle_exception(environ)

            raise
        finally:
            # wsgi spec requires iterable to call close if it exists
            # see http://blog.dscpl.com.au/2012/10/obligations-for-calling-close-on.html
            if iterable and hasattr(iterable, 'close') and callable(iterable.close):
                try:
                    iterable.close()
                except Exception:
                    self.handle_exception(environ)
            else:
                print "Force handle exception"
                self.handle_exception(environ)

The last else did work. And the Exception did get to the Sentry. The exception was empty. Just the name.

So the question here: is this a web.py issue ? or Raven. I am aware that raven is working according all WSGI specifications, but we did try using NewRelic before, and their wrapper worked just fine.

I will post similar issue on web.py repo as well. Hopefully we will figure something out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions