title: Handling errors properly in swift
body: <p>I am trying to learn swift and I have hit a wall... I want to be able to switch the type of error i get back so I can do different things. It works fine in the .success but not in the .failure</p>
  <pre><code> exporter.export(progressHandler: { (progress) in
              print(progress)
          }, completionHandler: { result in
  switch result {
                  case .success(let status):
                      switch status {
                      case .completed:
                          break
                                              
                      default:
                          break
                      }
                      break
                  case .failure(let error):
                      // I want to check what the error is 
                      // e.g. the debugger says its &quot;cancelled&quot;
                    
                   
                      break
              }
          })
  }
  </code></pre>
  <p>Can somebody help me with this?
  Thanks</p>