title: 'throw' of exception caught locally - Code duplication or warnings
body: <p>I know, that there is already few threads about this, but I am very courious what is more correct in this example:</p>
  <pre class="lang-js prettyprint-override"><code>// This is not correct and showing &quot;'throw' of exception caught locally&quot; warning
  function test1(input: any): boolean {
    try {
      if (!input)
        throw new Error(&quot;You not set test variable.&quot;);
      
      const number: int = parseInt(input); // This can throw exception too
      
      return true;
    } catch (err) {
      console.error(&quot;Error: &quot;, err);
      return false;
    }
  }
   
   
  // This is correct, but it is larger code and code duplication
  function test2(input: any): boolean {
    try {
      if (!input){
        console.error(&quot;Error: You not set test variable.&quot;);
        return false;
      }
      
      const number: int = parseInt(input); // This can throw exception too
      
      return true;
    } catch (err) {
      console.error(&quot;Error: &quot;, err);
      return false;
    }
  }
  </code></pre>
  <p>As you can see <code>test1()</code> will cause warning in most IDEs and it is not optimized by compiler, but there is no code duplication and excessive lines.</p>
  <p>I think this is not opinion based question, because then IDE will not warn you about using first example.</p>