rootstrap/exception_hunter

View on GitHub
docs/ExceptionHunter/Tracking.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Module: ExceptionHunter::Tracking
  
    &mdash; Documentation by YARD 0.9.26
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" />

<script type="text/javascript">
  pathId = "ExceptionHunter::Tracking";
  relpath = '../';
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div class="nav_wrap">
      <iframe id="nav" src="../class_list.html?1"></iframe>
      <div id="resizer"></div>
    </div>

    <div id="main" tabindex="-1">
      <div id="header">
        <div id="menu">
  
    <a href="../_index.html">Index (T)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../ExceptionHunter.html" title="ExceptionHunter (module)">ExceptionHunter</a></span></span>
     &raquo; 
    <span class="title">Tracking</span>
  
</div>

        <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>
    </a>
  
</div>
        <div class="clear"></div>
      </div>

      <div id="content"><h1>Module: ExceptionHunter::Tracking
  
  
  
</h1>
<div class="box_info">
  

  
  
  
  
  

  
  <dl>
    <dt>Included in:</dt>
    <dd><span class='object_link'><a href="../ExceptionHunter.html" title="ExceptionHunter (module)">ExceptionHunter</a></span></dd>
  </dl>
  

  
  <dl>
    <dt>Defined in:</dt>
    <dd>lib/exception_hunter/tracking.rb</dd>
  </dl>
  
</div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>Mixin used to track manual exceptions.</p>


  </div>
</div>
<div class="tags">
  

</div>






  
    <h2>
      Instance Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#track-instance_method" title="#track (instance method)">#<strong>track</strong>(exception, custom_data: {}, user: nil)  </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Used to manually track errors in cases where raising might not be adequate and but some insight is desired.</p>
</div></span>
  
</li>

      
    </ul>
  



  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="track-instance_method">
  
    #<strong>track</strong>(exception, custom_data: {}, user: nil)  
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p>
<p>Used to manually track errors in cases where raising might not be adequate and but some insight is desired.</p>


  </div>
</div>
<div class="tags">
  
  <div class="examples">
    <p class="tag_title">Examples:</p>
    
      
        <p class="example_title"><div class='inline'>
<p>Track the else clause on a case</p>
</div></p>
      
      <pre class="example code"><code><span class='kw'>case</span> <span class='id identifier rubyid_user'>user</span><span class='period'>.</span><span class='id identifier rubyid_status'>status</span>
<span class='kw'>when</span> <span class='symbol'>:active</span> <span class='kw'>then</span> <span class='id identifier rubyid_do_something'>do_something</span><span class='lparen'>(</span><span class='rparen'>)</span>
<span class='kw'>when</span> <span class='symbol'>:inactive</span> <span class='kw'>then</span> <span class='id identifier rubyid_do_something_else'>do_something_else</span><span class='lparen'>(</span><span class='rparen'>)</span>
<span class='kw'>else</span>
  <span class='const'><span class='object_link'><a href="../ExceptionHunter.html" title="ExceptionHunter (module)">ExceptionHunter</a></span></span><span class='period'>.</span><span class='id identifier rubyid_track'>track</span><span class='lparen'>(</span><span class='const'>StandardError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>User with unknown status</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='comma'>,</span>
                                          <span class='label'>custom_data:</span> <span class='lbrace'>{</span> <span class='label'>status:</span> <span class='id identifier rubyid_user'>user</span><span class='period'>.</span><span class='id identifier rubyid_status'>status</span> <span class='rbrace'>}</span><span class='comma'>,</span>
                                          <span class='label'>user:</span> <span class='id identifier rubyid_user'>user</span><span class='rparen'>)</span>
<span class='kw'>end</span></code></pre>
    
  </div>
<p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>exception</span>
      
      
        <span class='type'>(<tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>to track.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>custom_data</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>to include and help debug the error. (optional)</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>user</span>
      
      
        <span class='type'>(<tt>User</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>in the current session. (optional)</p>
</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


21
22
23
24
25
26
27
28
29</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/exception_hunter/tracking.rb', line 21</span>

<span class='kw'>def</span> <span class='id identifier rubyid_track'>track</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='comma'>,</span> <span class='label'>custom_data:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>user:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='kw'>if</span> <span class='id identifier rubyid_open_transactions?'>open_transactions?</span>
    <span class='id identifier rubyid_create_error_within_new_thread'>create_error_within_new_thread</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='comma'>,</span> <span class='id identifier rubyid_custom_data'>custom_data</span><span class='comma'>,</span> <span class='id identifier rubyid_user'>user</span><span class='rparen'>)</span>
  <span class='kw'>else</span>
    <span class='id identifier rubyid_create_error'>create_error</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='comma'>,</span> <span class='id identifier rubyid_custom_data'>custom_data</span><span class='comma'>,</span> <span class='id identifier rubyid_user'>user</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated on Fri Jul 30 14:46:20 2021 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.9.26 (ruby-2.6.5).
</div>

    </div>
  </body>
</html>