When should Throwable be used instead of new Exception?

前端 未结 12 1229
没有蜡笔的小新
没有蜡笔的小新 2020-11-28 08:21

Given: Throwable is Exception\'s superclass.

When I read texts on writing your own \'exceptions\', I see examples of Throwable

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 09:02

    All exceptions are a problem in the end... too say Errors are bugs doesnt mean anything.

    Errors are not bugs - they are problems that the host VM is experiencing, eg OutOfMemoryError. Exceptions are a means that the current operation may use to notify that it failed and perhaps provide some diagnosis.

提交回复
热议问题