hoodoo icon indicating copy to clipboard operation
hoodoo copied to clipboard

Introduce '!' method equivalents given new 'acquire_in'/'acquire_in!'

Open pond opened this issue 8 years ago • 0 comments

https://github.com/LoyaltyNZ/hoodoo/pull/223 introduces acquire_in, which adds errors to the given context automatically. This arises from the addition of generic.contemporary_exists, which would cause quite high and error-prone service implementation complexity if no automated approach was provided.

Although create-in/update-in/delete-in context mechanisms don't necessarily have the same level of complexity, there is still common boilerplate arising. For those who don't like the idea of mutating the context hierarchy then that approach is still fine, but adding in corresponding "!" methods makes sense for those who want simpler service code.

Examples:

  • update_in leads to update_in! (could add both "not-found" and e.g. validation errors)
  • manually_dated_destruction_in leads to manually_dated_destruction_in! (could add "not-found")

pond avatar Nov 01 '17 21:11 pond