Skip to content

Update exception terminology to clarify types of exceptions #2954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions concepts/exceptions/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ An exception is an event that occurs during the execution of a program that disr
Exceptions are raised explicitly in Java, and the act of raising an exception is called _throwing an exception_.
The act of handling an exception is called _catching an exception_.

Java distinguishes three types of exceptions:
Java distinguishes two types of exceptions:

1. Checked exceptions
2. Unchecked exceptions
3. Errors

### Checked exceptions

Expand All @@ -21,7 +20,7 @@ An example of a checked exception is the `FileNotFoundException` which occurs wh

This type of exception is checked at compile-time: methods that throw checked exceptions should specify this in their method signature, and code calling a method that might throw a checked exception is required to handle it or the code will not compile.

All exceptions in Java that do not inherit from `RuntimeException` or `Error` are considered checked exceptions.
All exceptions in Java that do not inherit from `RuntimeException` are checked exceptions.

### Unchecked exceptions

Expand All @@ -30,17 +29,17 @@ An example of an unchecked exception is the `NullPointerException` which occurs

This type of exception is not checked at compile-time: methods that throw unchecked exceptions are not required to specify this in their method signature, and code calling a method that might throw an unchecked exception is not required to handle it.

All exceptions in Java that inherit from `RuntimeException` are considered unchecked exceptions.
All exceptions in Java that inherit from `RuntimeException` are unchecked exceptions.

### Errors
## Errors

_Errors_ are exceptional conditions that are external to an application.
Java also has a separate category called _Errors_ which are serious problems that are external to an application.
An example of an error is the `OutOfMemoryError` which occurs when an application is trying to use more memory than is available on the system.

Like unchecked exceptions, errors are not checked at compile-time.
They are not usually thrown from application code.
Like unchecked exceptions, errors are not checked at compile-time and are not usually thrown from application code.
Unlike exceptions, Errors represent serious system-level problems that applications should generally not attempt to catch or handle.

All exceptions in Java that inherit from `Error` are considered errors.
All errors in Java inherit from the `Error` class.

## Throwing exceptions

Expand Down
17 changes: 8 additions & 9 deletions concepts/exceptions/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ An exception is an event that occurs during the execution of a program that disr
Exceptions are raised explicitly in Java, and the act of raising an exception is called _throwing an exception_.
The act of handling an exception is called _catching an exception_.

Java distinguishes three types of exceptions:
Java distinguishes two types of exceptions:

1. Checked exceptions
2. Unchecked exceptions
3. Errors

### Checked exceptions

Expand All @@ -21,7 +20,7 @@ An example of a checked exception is the `FileNotFoundException` which occurs wh

This type of exception is checked at compile-time: methods that throw checked exceptions should specify this in their method signature, and code calling a method that might throw a checked exception is required to handle it or the code will not compile.

All exceptions in Java that do not inherit from `RuntimeException` or `Error` are considered checked exceptions.
All exceptions in Java that do not inherit from `RuntimeException` are checked exceptions.

### Unchecked exceptions

Expand All @@ -30,17 +29,17 @@ An example of an unchecked exception is the `NullPointerException` which occurs

This type of exception is not checked at compile-time: methods that throw unchecked exceptions are not required to specify this in their method signature, and code calling a method that might throw an unchecked exception is not required to handle it.

All exceptions in Java that inherit from `RuntimeException` are considered unchecked exceptions.
All exceptions in Java that inherit from `RuntimeException` are unchecked exceptions.

### Errors
## Errors

_Errors_ are exceptional conditions that are external to an application.
Java also has a separate category called _Errors_ which are serious problems that are external to an application.
An example of an error is the `OutOfMemoryError` which occurs when an application is trying to use more memory than is available on the system.

Like unchecked exceptions, errors are not checked at compile-time.
They are not usually thrown from application code.
Like unchecked exceptions, errors are not checked at compile-time and are not usually thrown from application code.
Unlike exceptions, Errors represent serious system-level problems that applications should generally not attempt to catch or handle.

All exceptions in Java that inherit from `Error` are considered errors.
All errors in Java inherit from the `Error` class.

## Throwing exceptions

Expand Down
17 changes: 8 additions & 9 deletions exercises/concept/calculator-conundrum/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ An exception is an event that occurs during the execution of a program that disr
Exceptions are raised explicitly in Java, and the act of raising an exception is called _throwing an exception_.
The act of handling an exception is called _catching an exception_.

Java distinguishes three types of exceptions:
Java distinguishes two types of exceptions:

1. Checked exceptions
2. Unchecked exceptions
3. Errors

#### Checked exceptions

Expand All @@ -23,7 +22,7 @@ An example of a checked exception is the `FileNotFoundException` which occurs wh

This type of exception is checked at compile-time: methods that throw checked exceptions should specify this in their method signature, and code calling a method that might throw a checked exception is required to handle it or the code will not compile.

All exceptions in Java that do not inherit from `RuntimeException` or `Error` are considered checked exceptions.
All exceptions in Java that do not inherit from `RuntimeException` are checked exceptions.

#### Unchecked exceptions

Expand All @@ -32,17 +31,17 @@ An example of an unchecked exception is the `NullPointerException` which occurs

This type of exception is not checked at compile-time: methods that throw unchecked exceptions are not required to specify this in their method signature, and code calling a method that might throw an unchecked exception is not required to handle it.

All exceptions in Java that inherit from `RuntimeException` are considered unchecked exceptions.
All exceptions in Java that inherit from `RuntimeException` are unchecked exceptions.

#### Errors
### Errors

_Errors_ are exceptional conditions that are external to an application.
Java also has a separate category called _Errors_ which are serious problems that are external to an application.
An example of an error is the `OutOfMemoryError` which occurs when an application is trying to use more memory than is available on the system.

Like unchecked exceptions, errors are not checked at compile-time.
They are not usually thrown from application code.
Like unchecked exceptions, errors are not checked at compile-time and are not usually thrown from application code.
Unlike exceptions, Errors represent serious system-level problems that applications should generally not attempt to catch or handle.

All exceptions in Java that inherit from `Error` are considered errors.
All errors in Java inherit from the `Error` class.

### Throwing exceptions

Expand Down
Loading