http://18delphi.blogspot.com/2015/02/briefly-about-triggering-exceptions.html

http://18delphi.blogspot.com/2015/02/briefly-about-triggering-exceptions.html

Comments

  1. Yes, it's a good approach for predicates. :)

    ReplyDelete
  2. A good method, it improves the cleanness of the code, thanks!

    ReplyDelete
  3. IMHO some of the patterns published here are breaking the Single responsibility principle
    Exception classes should contain any exception-related methods, with some properties to store additional information (e.g. reference to the execution context, like a DB statement).
    The "check" methods should not be part of the exception, but to the corresponding process, perhaps in another class. You can then "inject" the exception class to the "check class" (with a parameter of type EMyExceptionClass = class of EMyException), so that you got the best of both worlds.

    ReplyDelete

Post a Comment