Thanks for posting this. I enjoyed the read, and I see what you mean re: exceptions vs. a domain error in ROP style paths.
I personally try to have my exceptions be just that, exceptions. If I can forsee something 'going wrong', I just make a domain error DU instance and handle it. Bonus points that the compiler says 'Hey you forgot this'.
Handled exceptions are like the short sale of program flow. You may not be foreclosed on (fatal error terminate execution), but it drops the hammer on your ~credit~ codebase (user interruptions, failed operations, maintainability headaches). Intentionally using exceptions in the domain types instead of putting up guard clauses and/or Failure result types is not something I'd recommend.
I personally try to have my exceptions be just that, exceptions. If I can forsee something 'going wrong', I just make a domain error DU instance and handle it. Bonus points that the compiler says 'Hey you forgot this'.
Handled exceptions are like the short sale of program flow. You may not be foreclosed on (fatal error terminate execution), but it drops the hammer on your ~credit~ codebase (user interruptions, failed operations, maintainability headaches). Intentionally using exceptions in the domain types instead of putting up guard clauses and/or Failure result types is not something I'd recommend.