Sija/raven.cr

Question using additional info

Closed this issue · 2 comments

I'm not sure if I have this setup correctly or not. Is this the proper way to use this?

def catch_exception(error : Exception, context : HTTP::Server::Context )
  Raven.extra_context({
        headers: context.request.headers.to_h,
        params: context.request.query_params.to_h,
        path: context.request.path
  })
  Raven.capture(error)
end
Sija commented

Well, IT depends ;) Do you use any framework?

  • If yes, and that's Kemal you might want to checkout Kemal integration
  • If yes, and that's Amber you're temporarily out of luck since Amber integration is broken ATM :(
  • If no, there's Raven::HTTPHandler module, which should give you an idea how to attach http interface, see relevant part:
    event.interface :http, {
    headers: headers_to_hash(request.headers),
    cookies: cookies_to_string(request.cookies),
    method: method,
    url: build_raven_http_url(context),
    query_string: request.query,
    data: data,
    }

Using Lucky 😄 Thanks for the info! I think that will help clarify for me.