doc/SidekiqUniqueJobs/RedisScript/LuaError.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Exception: SidekiqUniqueJobs::RedisScript::LuaError
— Documentation by YARD 0.9.34
</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 = "SidekiqUniqueJobs::RedisScript::LuaError";
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 (L)</a> »
<span class='title'><span class='object_link'><a href="../../SidekiqUniqueJobs.html" title="SidekiqUniqueJobs (module)">SidekiqUniqueJobs</a></span></span> » <span class='title'><span class='object_link'><a href="../RedisScript.html" title="SidekiqUniqueJobs::RedisScript (module)">RedisScript</a></span></span>
»
<span class="title">LuaError</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>Exception: SidekiqUniqueJobs::RedisScript::LuaError
</h1>
<div class="box_info">
<dl>
<dt>Inherits:</dt>
<dd>
<span class="inheritName">RuntimeError</span>
<ul class="fullTree">
<li>Object</li>
<li class="next">RuntimeError</li>
<li class="next">SidekiqUniqueJobs::RedisScript::LuaError</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/sidekiq_unique_jobs/redis_script/lua_error.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>LuaError raised on errors in Lua scripts</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Author:</p>
<ul class="author">
<li>
<div class='inline'><p>Mikael Henriksson <a href="mailto:mikael@mhenrixon.com">mikael@mhenrixon.com</a></p>
</div>
</li>
</ul>
</div>
<h2>
Constant Summary
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
</h2>
<dl class="constants">
<dt id="PATTERN-constant" class="">PATTERN =
<div class="docstring">
<div class="discussion">
<p>Reformats errors raised by redis representing failures while executing
a lua script. The default errors have confusing messages and backtraces,
and a type of +RuntimeError+. This class improves the message and
modifies the backtrace to include the lua script itself in a reasonable
way.</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>ERR Error (compiling|running) script \(.*?\): .*?:(\d+): (.*)</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
<dt id="LIB_PATH-constant" class="">LIB_PATH =
</dt>
<dd><pre class="code"><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>..</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid___dir__'>__dir__</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
<dt id="CONTEXT_LINE_NUMBER-constant" class="">CONTEXT_LINE_NUMBER =
</dt>
<dd><pre class="code"><span class='int'>2</span></pre></dd>
</dl>
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#content-instance_method" title="#content (instance method)">#<strong>content</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute content.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#error-instance_method" title="#error (instance method)">#<strong>error</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute error.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#file-instance_method" title="#file (instance method)">#<strong>file</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute file.</p>
</div></span>
</li>
</ul>
<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="#intercepts%3F-class_method" title="intercepts? (class method)">.<strong>intercepts?</strong>(error) ⇒ Boolean </a>
</span>
<span class="summary_desc"><div class='inline'><p>Is this error one that should be reformatted?.</p>
</div></span>
</li>
</ul>
<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="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(error, script) ⇒ LuaError </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'><p>Initialize a new <span class='object_link'><a href="" title="SidekiqUniqueJobs::RedisScript::LuaError (class)">LuaError</a></span> from an existing redis error, adjusting the message and backtrace in the process.</p>
</div></span>
</li>
</ul>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong>(error, script) ⇒ <tt><span class='object_link'><a href="" title="SidekiqUniqueJobs::RedisScript::LuaError (class)">LuaError</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Initialize a new <span class='object_link'><a href="" title="SidekiqUniqueJobs::RedisScript::LuaError (class)">SidekiqUniqueJobs::RedisScript::LuaError</a></span> from an existing redis error, adjusting
the message and backtrace in the process.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>error</span>
<span class='type'>(<tt>StandardError</tt>)</span>
—
<div class='inline'><p>the original error raised by redis</p>
</div>
</li>
<li>
<span class='name'>script</span>
<span class='type'>(<tt><span class='object_link'><a href="Script.html" title="SidekiqUniqueJobs::RedisScript::Script (class)">Script</a></span></tt>)</span>
—
<div class='inline'><p>a DTO with information about the script</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/redis_script/lua_error.rb', line 43</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='comma'>,</span> <span class='id identifier rubyid_script'>script</span><span class='rparen'>)</span>
<span class='ivar'>@error</span> <span class='op'>=</span> <span class='id identifier rubyid_error'>error</span>
<span class='ivar'>@file</span> <span class='op'>=</span> <span class='id identifier rubyid_script'>script</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span>
<span class='ivar'>@content</span> <span class='op'>=</span> <span class='id identifier rubyid_script'>script</span><span class='period'>.</span><span class='id identifier rubyid_source'>source</span>
<span class='ivar'>@backtrace</span> <span class='op'>=</span> <span class='ivar'>@error</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span>
<span class='ivar'>@error</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#PATTERN-constant" title="SidekiqUniqueJobs::RedisScript::LuaError::PATTERN (constant)">PATTERN</a></span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_regexp_match'>regexp_match</span><span class='op'>|</span>
<span class='id identifier rubyid_line_number'>line_number</span> <span class='op'>=</span> <span class='id identifier rubyid_regexp_match'>regexp_match</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_regexp_match'>regexp_match</span><span class='lbracket'>[</span><span class='int'>3</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_error_context'>error_context</span> <span class='op'>=</span> <span class='id identifier rubyid_generate_error_context'>generate_error_context</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_line_number'>line_number</span><span class='rparen'>)</span>
<span class='kw'>super</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n\n</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error_context'>error_context</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_set_backtrace'>set_backtrace</span><span class='lparen'>(</span><span class='id identifier rubyid_generate_backtrace'>generate_backtrace</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_line_number'>line_number</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_attr_details" class="attr_details">
<h2>Instance Attribute Details</h2>
<span id=""></span>
<div class="method_details first">
<h3 class="signature first" id="content-instance_method">
#<strong>content</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute content.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
27
28
29</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/redis_script/lua_error.rb', line 27</span>
<span class='kw'>def</span> <span class='id identifier rubyid_content'>content</span>
<span class='ivar'>@content</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="error-instance_method">
#<strong>error</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute error.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
27
28
29</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/redis_script/lua_error.rb', line 27</span>
<span class='kw'>def</span> <span class='id identifier rubyid_error'>error</span>
<span class='ivar'>@error</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="file-instance_method">
#<strong>file</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute file.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
27
28
29</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/redis_script/lua_error.rb', line 27</span>
<span class='kw'>def</span> <span class='id identifier rubyid_file'>file</span>
<span class='ivar'>@file</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="class_method_details" class="method_details_list">
<h2>Class Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="intercepts?-class_method">
.<strong>intercepts?</strong>(error) ⇒ <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Is this error one that should be reformatted?</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>error</span>
<span class='type'>(<tt>StandardError</tt>)</span>
—
<div class='inline'><p>the original error raised by redis</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Boolean</tt>)</span>
—
<div class='inline'><p>is this an error that should be reformatted?</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
33
34
35</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/redis_script/lua_error.rb', line 33</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_intercepts?'>intercepts?</span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span>
<span class='const'><span class='object_link'><a href="#PATTERN-constant" title="SidekiqUniqueJobs::RedisScript::LuaError::PATTERN (constant)">PATTERN</a></span></span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Wed Jan 24 10:57:26 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
</div>
</body>
</html>