title: Difference between Xcode Project and Playground about Swift error handling
body: <ul>
  <li>Why do I need to provide general <code>catch</code> statement for do-try-catch, even though I'm sure my custom error is only thrown in do-try-catch statement? </li>
  <li>And, why is this behavior different between Xcode Project and Playground?</li>
  </ul>
  
  <p>I tried to use a simple Swift's do-try-catch error in my iOS application.</p>
  
  <pre><code>enum FooError: Error {
      case foo
  }
  
  func fooFunc() throws {
      throw FooError.foo
  }
  </code></pre>
  
  <p>When I call this function, I tried to catch only <code>FooError.foo</code> error.</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
      do {
          try fooFunc()
      } catch FooError.foo {
          print("foo error is thrown.")
      }
  }
  </code></pre>
  
  <p>But this got a compile error <code>"Errors thrown from here are not handled because the enclosing catch is not exhaustive"</code>.</p>
  
  <p>The reason this compile error is thrown is my catch statement is not enough, and I can fix this error by adding general <code>catch</code> statement.</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
      do {
          try fooFunc()
      } catch FooError.foo {
          print("foo error is thrown.")
      } catch {
          print("something else wrong happened. \(error)")
      }
  }
  </code></pre>
  
  <p>I thought <code>fooFunc</code> throws only <code>FooError</code>, so the catch statement is already exhaustive without general catch, but it seems I need to add it. </p>
  
  <p>Even the weird thing is the general <code>catch</code> statement is not needed when I run this code on Playground.</p>
  
  <pre><code>do {
      try fooFunc()
  } catch FooError.foo {
      print("foo error is thrown.")
  }
  </code></pre>
  
  <p>I was wondering why the error handling behavior is different between Xcode Project and Playground.</p>