Is it a good or bad idea throwing Exceptions when validating data?

后端 未结 14 958
你的背包
你的背包 2020-12-07 16:27

When validating data, I\'ve gotten into a habit of doing the following:

Note: I don\'t really have individual booleans for each check. This is just

14条回答
  •  孤街浪徒
    2020-12-07 16:47

    This is bad behavior. Exceptions are for Exceptional conditions. They take resources to generate the stack etc. Exceptions should not be used to dictate process flow.

提交回复
热议问题