How do we work with errors in asynchronous Swift code?
Throwing errors and completion handlers have pros and cons, and can’t be used in all situations. Here we examine some strategies for writing elegant async error-handling code with closures and associated-value enumerations.
A similar approach from our blog
Swift Error Handling Swift Closures