title: 'throw' of exception caught locally. Why is this bad?
body: <p>I have a piece of code which looks something like this:</p>
  
  <pre><code>try {
    if( !request.body || !request.body.device ) {
      throw new FooError( "missing 'device'" );
    }
    if( !request.body.device.type ) {
      throw new BarError( "missing 'device.type'" );
    }
    if( request.body.device.type != "ios" ) {
      throw new BazError( "unexpected 'device.type'" );
    }
  } catch( error ) {
    // handle error and communicate message to the user
  }
  </code></pre>
  
  <p>WebStorm highlights the 3 <code>throw</code> terms and gives the following explanation:</p>
  
  <blockquote>
    <p>'throw' of exception caught locally</p>
    
    <p>This inspection reports any instances of JavaScript <strong>throw</strong> statements whose exceptions are always caught by containing <strong>try</strong> statements. Using <strong>throw</strong> statements as a "goto" to change the local flow of control is likely to be confusing.</p>
  </blockquote>
  
  <p>I don't understand that reasoning. Why would this likely be confusing and what would be the less confusing alternative?</p>