catch 句での Throwable と Exception 違い

  • Throwable は JVM レベルでの Serious Error を catch する時に使う
    • Exception より高階層な API
  • Exception はアプリケーションレベルでの例外を catch する時に使う
    • Throwable より低階層な API
    • app 構築に当たるならこちらを使うべき

Throwable

The Throwable class is the superclass of all errors and exceptions in the Java language. 

Exception

The class Exception and its subclasses are a form of Throwable

that indicates conditions that a reasonable application might want to catch.

補足記事

stackoverflow.com

stackoverflow.com