rootstrap/exception_hunter

View on GitHub
docs/ExceptionHunter/ErrorCreator.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>
  Class: ExceptionHunter::ErrorCreator
  
    &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::ErrorCreator";
  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 (E)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../ExceptionHunter.html" title="ExceptionHunter (module)">ExceptionHunter</a></span></span>
     &raquo; 
    <span class="title">ErrorCreator</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>Class: ExceptionHunter::ErrorCreator
  
  
  
</h1>
<div class="box_info">
  
  <dl>
    <dt>Inherits:</dt>
    <dd>
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ExceptionHunter::ErrorCreator</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
    </dd>
  </dl>
  

  
  
  
  
  

  

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

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>Core class in charge of the actual persistence of errors and notifications.</p>


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

</div>
  
    <h2>
      Constant Summary
      <small><a href="#" class="constants_summary_toggle">collapse</a></small>
    </h2>

    <dl class="constants">
      
        <dt id="HTTP_TAG-constant" class="">HTTP_TAG =
          <div class="docstring">
  <div class="discussion">
    

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

</div>
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>HTTP</span><span class='tstring_end'>&#39;</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
      
        <dt id="WORKER_TAG-constant" class="">WORKER_TAG =
          <div class="docstring">
  <div class="discussion">
    

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

</div>
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Worker</span><span class='tstring_end'>&#39;</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
      
        <dt id="MANUAL_TAG-constant" class="">MANUAL_TAG =
          <div class="docstring">
  <div class="discussion">
    

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

</div>
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Manual</span><span class='tstring_end'>&#39;</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
      
        <dt id="NOTIFICATION_DELAY-constant" class="">NOTIFICATION_DELAY =
          <div class="docstring">
  <div class="discussion">
    

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

</div>
        </dt>
        <dd><pre class="code"><span class='int'>1</span><span class='period'>.</span><span class='id identifier rubyid_minute'>minute</span></pre></dd>
      
    </dl>
  







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

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#call-class_method" title="call (class method)">.<strong>call</strong>(async_logging: Config.async_logging, tag: nil, **error_attrs)  &#x21d2; ExceptionHunter::Error, false </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Creates an error with the given attributes and persists it to the database.</p>
</div></span>
  
</li>

      
    </ul>
  



  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="call-class_method">
  
    .<strong>call</strong>(async_logging: Config.async_logging, tag: nil, **error_attrs)  &#x21d2; <tt>ExceptionHunter::Error</tt>, <tt>false</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Creates an error with the given attributes and persists it to the database.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>tag</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="#HTTP_TAG-constant" title="ExceptionHunter::ErrorCreator::HTTP_TAG (constant)">HTTP_TAG</a></span></tt>, <tt><span class='object_link'><a href="#WORKER_TAG-constant" title="ExceptionHunter::ErrorCreator::WORKER_TAG (constant)">WORKER_TAG</a></span></tt>, <tt><span class='object_link'><a href="#MANUAL_TAG-constant" title="ExceptionHunter::ErrorCreator::MANUAL_TAG (constant)">MANUAL_TAG</a></span></tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>to append to the error if any</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>ExceptionHunter::Error</tt>, <tt>false</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>the error or false if it was not possible to create it</p>
</div>
      
    </li>
  
</ul>

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


15
16
17
18
19
20
21
22
23
24
25
26</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/exception_hunter/error_creator.rb', line 15</span>

<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='label'>async_logging:</span> <span class='const'><span class='object_link'><a href="Config.html" title="ExceptionHunter::Config (class)">Config</a></span></span><span class='period'>.</span><span class='id identifier rubyid_async_logging'><span class='object_link'><a href="Config.html#async_logging-instance_method" title="ExceptionHunter::Config#async_logging (method)">async_logging</a></span></span><span class='comma'>,</span> <span class='label'>tag:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_error_attrs'>error_attrs</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_should_create?'>should_create?</span>

  <span class='kw'>if</span> <span class='id identifier rubyid_async_logging'>async_logging</span>
    <span class='comment'># Time is sent in unix format and then converted to Time to avoid ActiveJob::SerializationError
</span>    <span class='op'>::</span><span class='const'><span class='object_link'><a href="../ExceptionHunter.html" title="ExceptionHunter (module)">ExceptionHunter</a></span></span><span class='op'>::</span><span class='const'>AsyncLoggingJob</span><span class='period'>.</span><span class='id identifier rubyid_perform_later'>perform_later</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span><span class='comma'>,</span> <span class='id identifier rubyid_error_attrs'>error_attrs</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='label'>occurred_at:</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='rparen'>)</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_tag'>tag</span><span class='comma'>,</span> <span class='id identifier rubyid_error_attrs'>error_attrs</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>rescue</span> <span class='const'>ActiveRecord</span><span class='op'>::</span><span class='const'>RecordInvalid</span>
  <span class='kw'>false</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>