Catching exceptions produced by Swift