For example ( in Java) : throw. · Magical Error Handling in Swift. You’ ll clean up this code significantly with custom error. catch all other errors and print out a nice message. Intro to Error Handling in Swift Try. I told my 13- year- old sister that error handling was another way to write an if- else block to send an error message. Error handling in Swift interoperates with error handling patterns that use the NSError class in Cocoa and Objective- C. handles the error by printing a message.