<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="216688" data-post-id="216688">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kokolegorille" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kokolegorille/120/4784_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kokolegorille
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Fl4m3Ph03n1x" data-post="8" data-topic="40293">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/fl4m3ph03n1x/48/11709_2.png" class="avatar"> Fl4m3Ph03n1x:</div>
<blockquote>
<pre data-code-wrap="elixir"><code class="lang-elixir">  def hello(n) do

    if n == 10 do
      true
    else
      raise "This is not a number!"
    end

  end
</code></pre>
</blockquote>
</aside>
<p>The solution <a class="mention" href="/u/peerreynders" rel="nofollow">@peerreynders</a> proposed in the similar question I had was to do something like this…</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  def hello(n) do

    if n == 10 do
      hello_success()
    else
      hello_error()
    end

  end
</code></pre>
<p>This way You can detect type error in the smaller functions.</p>
<p>Here is the solution he provided in my question…</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">   cond do
     qty &lt; 0     -&gt;
       create_unit_quantity_error("unit_quantity can not be negative")
     qty &gt; 1_000 -&gt;
       create_unit_quantity_error("unit_quantity can not be more than 1000")
     true        -&gt;
       create_unit_quantity_success(qty)
    end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="216688" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/dialyzer-and-raise-exception-behavior/40293/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-216688" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="216688"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="216692" data-post-id="216692">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Fl4m3Ph03n1x" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Fl4m3Ph03n1x/120/11709_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Fl4m3Ph03n1x
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule TestDialzer do

  @spec hello(integer) :: boolean
  def hello(n) do

    if n == 10 do
      hello_success()
    else
      hello_error()
    end

  end

  @spec test_hello_1 :: boolean
  def test_hello_1, do: hello(10)

  @spec test_hello_2 :: boolean
  def test_hello_2, do: hello(1)

  @spec hello_success :: true
  defp hello_success, do: true

  # This is clearly wrong, yet no complaining =(
  @spec hello_error :: boolean
  defp hello_error, do: raise "This is not a number!"

end
</code></pre>
<p>I am quite lost here. Dialyzer is not picking up that <code>hello_error</code> has an wrong spec.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="216692" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/dialyzer-and-raise-exception-behavior/40293/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-216692" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="216692"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>