ing-bank/baker

Split up IllegalArgumentException for the fireEvent and similar operations

Tim-Linschoten opened this issue · 1 comments

When using the fireEvent (and friends) baker can return an IllegalArgumentException.

  • bake uses IllegalArgumentException for case when recipe instance already exists
  • bake uses IllegalArgumentException for case when recipe does not exist
  • fireEvent (and friends) uses IllegalArgumentException for case when event was invalid (when is the event invalid, btw?)

Using the same exception makes it impossible (well, brittle) to tell one failure type from another on the client side.

It would be better if each of these had their own type of exception, e.g. RecipeInstanceExists, RecipeNotFound, InvalidEvent? This would be consistent with how other failure types are handled, e.g. RecipeValidationException, NoSuchProcessException, ProcessDeletedException, ...)