05 Exceptions
05 Exceptions
◦ The Programmer
Misunderstanding requirements and/or contract
◦ The Environment
The VM, OS, hardware, etc.
In this case:
- The error source is the end user.
- The incorrect operation is invalid
- The exception was not caught
Sources
Programmer,
End User, or Logic
Handler
Environment Error
yes yes
Error
Incorrect Valid
Exception Caught? Runti me
Operations Operation? no no Error
Example 2:
◦ Prompt for a filename
◦ Loop until the user provides a valid filename
Example:
◦ When you catch the FileNotFoundException, you
know that the file you attempted to access does not
exist