异常捕获何时用Exception,何时用Throwable

用Exception的情况
try {
       //可能发生空指针、数组溢出等异常
        } catch (Exception e) {
            throw new CashierIntegrationException();
        }

用Throwable的情况
try {
        //可能发生空指针、数组溢出、NoClassDefFoundError等异常
        } catch (Throwable e) {
            throw new CashierIntegrationException();
        }

你可能感兴趣的:(异常捕获何时用Exception,何时用Throwable)