InvalidInput

Obviously, whenever some input data is wrong.

This one is probably your best friend, and the one you have to specialize the most for any given problem domain. Otherwise you just wind up with a bunch of nonsense, obtuse errors like:

  • "the input was wrong"
  • "gee, thanks, more details, please?"
  • sometimes you might be tempted to use NotFound, but this might be better suited. For instance, when you are dealing with a "foreign key" situation, and the foreign key is the input of the client. You'd want to be able to tell the user that their input was wrong because something was not found, not simply that it was not found.

Therefore, specialize frantically.

class Object
trait Matchable
class Any