ruby.json 3.8 KB

123456
  1. {
  2. "html": "<div class=\"section\" id=\"installation\">\n<h2>Installation</h2>\n<p>Raven Ruby comes as a gem and is straightforward to install. If you are\nusing Bundler just add this to your <code class=\"docutils literal\"><span class=\"pre\">Gemfile</span></code>:</p>\n<div class=\"highlight-ruby\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span><span style=\"color: #111111\">gem</span> <span style=\"color: #e8535a\">&quot;sentry-raven&quot;</span>\n</pre></div>\n</div>\n<p>For other means of installation see <a class=\"reference internal\" href=\"https://docs.getsentry.com/clients/ruby/install/\"><em>Installation</em></a>.</p>\n</div>\n\n\n<div class=\"section\" id=\"configuration\">\n<h2>Configuration</h2>\n<p>To use Raven Ruby all you need is your DSN. Like most Sentry libraries it\nwill honor the <code class=\"docutils literal\"><span class=\"pre\">SENTRY_DSN</span></code> environment variable. You can find it on\nthe project settings page under API Keys. You can either export it as\nenvironment variable or manually configure it with <code class=\"docutils literal\"><span class=\"pre\">Raven.configure</span></code>:</p>\n<div class=\"highlight-ruby\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span><span style=\"color: #111111\">Raven</span><span style=\"color: #4b4f5c\">.</span><span style=\"color: #111111\">configure</span> <span style=\"color: #2eb0f7\">do</span> <span style=\"color: #4b4f5c\">|</span><span style=\"color: #111111\">config</span><span style=\"color: #4b4f5c\">|</span>\n <span style=\"color: #111111\">config</span><span style=\"color: #4b4f5c\">.</span><span style=\"color: #111111\">dsn</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">&#39;___DSN___&#39;</span>\n<span style=\"color: #2eb0f7\">end</span>\n</pre></div>\n</div>\n</div>\n\n\n<div class=\"section\" id=\"reporting-failures\">\n<h2>Reporting Failures</h2>\n<p>If you use Rails, Rake, Sidekiq, etc, you&#8217;re already done - no more\nconfiguration required! Check <a class=\"reference internal\" href=\"https://docs.getsentry.com/clients/ruby/integrations/\"><em>Integrations</em></a> for more details on\nother gems Sentry integrates with automatically.</p>\n<p>Rack requires a little more setup: <a class=\"reference internal\" href=\"https://docs.getsentry.com/clients/ruby/integrations/rack/\"><em>Rack (Sinatra etc.)</em></a></p>\n<p>Otherwise, Raven supports two methods of capturing exceptions:</p>\n<div class=\"highlight-ruby\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span><span style=\"color: #111111\">Raven</span><span style=\"color: #4b4f5c\">.</span><span style=\"color: #111111\">capture</span> <span style=\"color: #2eb0f7\">do</span>\n <span style=\"color: #34c08b; font-style: italic\"># capture any exceptions which happen during execution of this block</span>\n <span style=\"color: #45c2c9\">1</span> <span style=\"color: #4b4f5c\">/</span> <span style=\"color: #45c2c9\">0</span>\n<span style=\"color: #2eb0f7\">end</span>\n\n<span style=\"color: #2eb0f7\">begin</span>\n <span style=\"color: #45c2c9\">1</span> <span style=\"color: #4b4f5c\">/</span> <span style=\"color: #45c2c9\">0</span>\n<span style=\"color: #2eb0f7\">rescue</span> <span style=\"color: #111111\">ZeroDivisionError</span> <span style=\"color: #4b4f5c\">=&gt;</span> <span style=\"color: #111111\">exception</span>\n <span style=\"color: #111111\">Raven</span><span style=\"color: #4b4f5c\">.</span><span style=\"color: #111111\">capture_exception(exception)</span>\n<span style=\"color: #2eb0f7\">end</span>\n</pre></div>\n</div>\n</div>\n",
  3. "link": "https://docs.getsentry.com/clients/ruby/",
  4. "id": "ruby",
  5. "name": "Ruby"
  6. }