I really like the points made in this article about Swift error handling: using
catch is actually much better than returning optionals or the new
Throwing errors, when used throughout your codebase, helps you reduce and simplify code. It makes your unit testing easier too.
As a former Java programmer, I have to admit some hesitance to
throw anything. Java error handling can turn into a nightmare of its own.
But the author makes some compelling arguments why
throwing might make sense in Swift. Error handling is never fun; let’s do it the easy way. 🤷🏻♂️
Via iOS Dev Weekly.