<div dir="ltr">&quot;so pretty much every non-trivial #swift function should throw, right?  cheap &amp; gives caller choice to catch, rethrow, try? or try!  (4 in 1)&quot;<div><div>-- <a href="https://twitter.com/johnspurlock/status/704478619779866625">https://twitter.com/johnspurlock/status/704478619779866625</a></div></div><div><br></div><div>One of the annoying things about checked exceptions in other languages is that they somewhat dictate client behavior wrt error handling and flow.  Also expensive (for some value of expensive) when they occur, so not a good choice for standard-case control flow.</div><div><br></div><div>Given that Swift provides multiple language-standard ways for clients to deal with a function marked as &#39;throws&#39;, it seems like almost all non-trivial shared functions should provide the additional information of the error in that standard form, instead of hiding it behind an optional return type or a bespoke error callback argument.</div><div><br></div><div>i.e. always:  func parse(str: String) throws -&gt; Foo</div><div>instead of: func parse(str: String) -&gt; Foo?    // loss of information: why did it fail?</div>







</div>