title: Should I use enums or class hierarchy for errors in swift?
body: <p>In Swift 2 any type that conforms to ErrorType protocol can be thrown and caught. For me, it makes sense to have a common error hierarchy and re-use it in multiple places. But, Apple documentation seems to push developers into using enums for handling errors.</p>
  
  <p>For example, this hierarchy will let me catch and process a common ValidationError without knowing it's exact sub-type. This will also allow different parts of the application to extend ValidationError.</p>
  
  <pre><code>MyAppError
      ValidationError
          InvalidPathError
          WrongFileTypeError
  </code></pre>
  
  <p>Mixing different styles of defining errors does not look like a good idea. So, should I model all error handling around class hierarchies or enums?</p>