Execution-time errors – or, in programming, Exceptions – are a rather normal, even though unpleasant, thing of every coder’s life. However, they can be prevented – or at least, at times. This is where Error Handling comes into play.
Error handling is nothing but a fancy name to describe the process of responding to the occurrence, during computation, of exceptions – anomalous conditions, that is, that may require some special processing. And Swift sure makes our life a lot easier.
11.1 Create a custom error
Problem
I want to create a new custom error type.