commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CRYPTO-95) Code should never catch Throwable
Date Thu, 30 Jun 2016 11:29:10 GMT
Sebb created CRYPTO-95:
--------------------------

             Summary: Code should never catch Throwable
                 Key: CRYPTO-95
                 URL: https://issues.apache.org/jira/browse/CRYPTO-95
             Project: Commons Crypto
          Issue Type: Bug
            Reporter: Sebb


As a general rule, code should never catch Throwable or Error, only Exception.

Sometimes it is necessary to catch more than just Exception, but if so, the code must be careful
to rethrow certain errors, e.g.

ThreadDeath
VirtualMachineError

There may be some others

If the throwable is not logged, then it's vital to ensure that only the appropriate ones are
swallowed.

But it is better to be explicit and only catch errors which are safe to handle.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message