Should a business rule violation throw an exception?

后端 未结 14 630
误落风尘
误落风尘 2021-02-04 04:18

Should a business rule violation throw an exception?

14条回答
  •  隐瞒了意图╮
    2021-02-04 04:52

    Business rules should not throw an exception, unless they are used to validate parameters of some API (i.e.: checking requests validity) or in unit tests (i.e.: using business rules to simplify .NET unit tests).

    Generally business rules output error and warning messages to the validation scope, though.

提交回复
热议问题