Java - example of a custom checked exception