Github user srowen commented on the issue:

    https://github.com/apache/spark/pull/16002
  
    Yes, echoing @sethah, can I ask what the problem being solved is? I 
understand being careful with what exactly is thrown from _public_ methods 
because they end up forming part of the API, but this seems to be about 
internal-only APIs.
    
    I have heard the mantra "don't use exceptions for control flow" but it's 
wrong. They are certainly a valid way to signal an out-of-band result from a 
method. In fact, it's a mechanism with its own language support. Reinventing 
exception handling without exceptions using error codes is just using 
"exceptions" for control flow but without actual making use of the simple 
mechanism for it.
    
    It's true that making an exception can be non-trivially expensive because 
it must fill in a stack trace, but that's no issue here (and can be suppressed 
if needed)
    
    Of course there are ways to abuse any language mechanism, and cases where 
exceptions shouldn't be used, but exceptional cases like "the matrix is 
singular" are what exceptions are for.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to