Hi Zsolt,

First I am installing pyramid_raven:

https://github.com/thruflo/pyramid_raven

Then I capture exceptions in HTTP 500 view as:

https://github.com/websauna/websauna/blob/master/websauna/system/core/views/internalservererror.py#L13

On Saturday, March 19, 2016 at 5:49:30 PM UTC-7, Zsolt Ero wrote:
>
> Yes, that is how I started. The problem is with client.captureException(). 
>
> The problem is that there is no way to get the Client when it's 
> configured via ini (or at least I have no idea how to get it). 
>
> So when configured via ini, Sentry can only provide HTTP context for 
> uncaught exceptions which results in an Internal Server Error. 
>
> Obviously, your web app shouldn't result in Internal Server Errors, 
> but would try to give a reasonable error message, and internally log 
> the problem, so critical parts are in try-except blocks, and this is 
> where client.captureException() is used. 
>
> try: 
>     ... 
> except Exception: 
>    client.captureException() 
>
> Now this client needs to be configured via a Sentry __call__, or else, 
> the http context is missing. That's why I needed to use the python 
> config vay. 
>
> On 20 March 2016 at 01:00, Michael Merickel <mmer...@gmail.com 
> <javascript:>> wrote: 
> > I'm missing something here probably but the raven docs have pretty 
> > straightforward support for configuring it via the ini file. Have you 
> tried 
> > this? 
> > 
> > 
> https://docs.getsentry.com/hosted/clients/python/integrations/pyramid/#pastedeploy-filter
>  
> > 
> > On Sat, Mar 19, 2016 at 5:44 PM, Zsolt Ero <zsol...@gmail.com 
> <javascript:>> wrote: 
> >> 
> >> Thanks, I was able to make a working client, but not using the pipeline 
> + 
> >> filter part in the ini, but by wrapping app by: 
> >> 
> >> from raven import Client 
> >> 
> >> from raven.middleware import Sentry 
> >> 
> >> 
> >> client = Client('https://...:...@app.getsentry.com/...') 
> >> 
> >> app = Sentry(app, client=client) 
> >> 
> >> 
> >> This way client is configured on init and captureException works 
> >> automatically. 
> >> 
> >> 
> >> 
> >> 
> >> Friday, March 18, 2016 at 1:26:39 AM UTC+1, Zsolt Ero wrote: 
> >>> 
> >>> Thanks, I see. I believe this way I do not need the .ini part, do I? 
> >>> 
> >>> On Thursday, March 17, 2016 at 3:40:28 AM UTC+1, Jonathan Vanasco 
> wrote: 
> >>>> 
> >>>> 
> >>>> 
> >>>> On Wednesday, March 16, 2016 at 9:36:44 PM UTC-4, Zsolt Ero wrote: 
> >>>>> 
> >>>>> David Cramer from Sentry replied to me that if Sentry is used with 
> the 
> >>>>> middleware, then it should automatically receive the WSGI context: 
> >>>>> from sentry.middleware import Sentry 
> >>>>> 
> >>>>> application = Sentry(application, client=Client(dsn, ...)) 
> >>>>> 
> >>>>> My problem is that in Pyramid I have no idea where could I get an 
> >>>>> application, or if this would work at all. 
> >>>> 
> >>>> 
> >>>> That looks like the initial app setup in your `project/__init__.py` 
> >>>> 
> >>>> `application` would be what is returned from config.make_wsgi_app() 
> >>>> 
> >>>> Some people do "return config.make_wsgi_app()" 
> >>>> 
> >>>> Others prefer "app = config.make_wsgi_app()", then wrap it in 
> middleware 
> >>>> 
> >>>> 
> >> -- 
> >> You received this message because you are subscribed to the Google 
> Groups 
> >> "pylons-devel" group. 
> >> To unsubscribe from this group and stop receiving emails from it, send 
> an 
> >> email to pylons-devel...@googlegroups.com <javascript:>. 
> >> To post to this group, send email to pylons...@googlegroups.com 
> <javascript:>. 
> >> Visit this group at https://groups.google.com/group/pylons-devel. 
> >> For more options, visit https://groups.google.com/d/optout. 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to a topic in the 
> > Google Groups "pylons-devel" group. 
> > To unsubscribe from this topic, visit 
> > https://groups.google.com/d/topic/pylons-devel/ou3XQ6OC4OQ/unsubscribe. 
> > To unsubscribe from this group and all its topics, send an email to 
> > pylons-devel...@googlegroups.com <javascript:>. 
> > To post to this group, send email to pylons...@googlegroups.com 
> <javascript:>. 
> > Visit this group at https://groups.google.com/group/pylons-devel. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to