title: Returning a value from try-catch
body: <p>Here is a method in Scala:</p>
  
  <pre><code>def method1(arg: String*): List[String] = {
          try {
            new MyClass(new URL(arg(0)))
              .map(x =&gt; x.getRawString.toString)
          }
          catch {
            case e: Exception =&gt; e.printStackTrace()
          }
  }
  </code></pre>
  
  <p>It complains on </p>
  
  <pre><code>found   : Unit
  [error]  required: List[String]
  </code></pre>
  
  <p>If I added an additional value so that:</p>
  
  <pre><code>def method1(arg: String*): List[String] = {
          val result = try {
            new MyClass(new URL(arg(0)))
              .map(x =&gt; x.getRawString.toString)
          }
          catch {
            case e: Exception =&gt; e.printStackTrace()
          }
  
         result
  }
  </code></pre>
  
  <p>it would say </p>
  
  <pre><code>found   : Any
  [error]  required: List[String]
  </code></pre>
  
  <p>which is odd -- isn't this the same as the first approach?</p>
  
  <p>Anyway, what is the Scala's standard way of dealing with this kind of situations -- returning a value from <code>try { .. } catch { .. }</code> ?</p>