Skip to content
Closed
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
15 changes: 15 additions & 0 deletions exercises/practice/wordy/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Instructions append

## Exception messages

Sometimes it is necessary to [throw an exception](https://docs.oracle.com/javase/tutorial/essential/exceptions/throwing.html).
When you do this, you should always include a **meaningful error message** to indicate what the source of the error is.
This makes your code more readable and helps significantly with debugging.

This particular exercise requires that you use the [throw keyword](https://docs.oracle.com/javase/tutorial/essential/exceptions/throwing.html)
to "throw" an `IllegalArgumentException` if the question passed to `solve()` contains an unsupported operation, is not a math question, or has invalid syntax.
The tests will only pass if you both `throw` the `exception` and include this exact message with it, which is the same for every case:

```java
throw new IllegalArgumentException("I'm sorry, I don't understand the question!");
```