site
site copied to clipboard
Article: Why throwing errors isn't type-safe
Overview
Speaking generally: https://softwareengineering.stackexchange.com/questions/189222/are-exceptions-as-control-flow-considered-a-serious-antipattern-if-so-why is a good summary of my perspective here.
I think the most salient point is the Principle of Least Astonishment. Since exceptions can't reasonably be indicated in type signatures, using exceptions requires developers memorizing which functions may throw them as a part of their "normal" flow. That's a recipe for astonishment - especially if the implicit intentional-exception-throwing contract changes unexpectedly.