Theodor
Theodor

Reputation: 5656

Eclipse warn about uncaught Error

When failing to catch a subclass of Exception, Eclipse will issue a compilation warning (red).

However, when an subclass of Error is uncaught, no warning is issued, making it easy to forget including the throws SomethingError statement.

Upvotes: 0

Views: 285

Answers (2)

Bananeweizen
Bananeweizen

Reputation: 22070

This is essentially to avoid having to add exception handling code to every trivial line of code that you write. This question explains that really well: Why are Runtime Exceptions "unchecked" in Java?

Upvotes: 1

Adam
Adam

Reputation: 36723

This is the difference between checked (subclasses of Exception excluding RuntimeException) and unchecked exceptions (subclasses of RuntimeException or Error).

Upvotes: 2

Related Questions