Correct exception to throw for an unhandled switch case for an argument?

后端 未结 5 2323
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 22:26

NOTE: This is different than the proposed duplicates as this deals with an argument rather than a value. The behavior and applicable scenarios are essentially different.

5条回答
  •  深忆病人
    2021-02-19 22:32

    I'd throw the InvalidEnumArgumentException as it will give more detailed information in this case, you are checking on an enum

提交回复
热议问题