GithubHelp home page GithubHelp logo

Comments (5)

getsantry avatar getsantry commented on May 30, 2024

Assigning to @getsentry/support for routing ⏲️

from sentry-docs.

getsantry avatar getsantry commented on May 30, 2024

Routing to @getsentry/product-owners-sdks-web-backend for triage ⏲️

from sentry-docs.

sl0thentr0py avatar sl0thentr0py commented on May 30, 2024

hey @amo13 i'll add some clarification to the docs but the quick answer for you is that a before_action should work.

from sentry-docs.

amo13 avatar amo13 commented on May 30, 2024

Thank you very much. This unfortunately does not answer my question just yet:
In my rails project, I define exception classes and use raise MyError, "Some text telling what happened" in the code (not only controller, also model, modules, jobs, etc.). What I'd like to achieve is to submit additional context from there, where I raise MyError, maybe to catch arguments given to the method raising MyError, or to add the state of some linked object.

I was hoping for something like

def method_anywhere_in_project
  ...
  raise MyError.new(context1: "something", context2: 42)
  ...
end

...and maybe magically when sentry catches that error, it would submit context1 and context2 as part of the Exception.

from sentry-docs.

sl0thentr0py avatar sl0thentr0py commented on May 30, 2024

You can't add those to the exception instance but you can do the following even in your model method and when sentry captures that exception it will pick up this data. Think of the scope as state that is flowing along with your request logic and it gets picked up when the event is finally sent to sentry.

Sentry.configure_scope do |scope|
  scope.set_context(
    'character',
    {
      name: 'Mighty Fighter',
      age: 19,
      attack_type: 'melee'
    }
  )
end

from sentry-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.