What factors should be taken into consideration when writing a custom exception class?

后端 未结 7 937
甜味超标
甜味超标 2020-12-29 15:38

When are custom Exception classes most-valuable?
Are there cases when they should or should not be used? What are the benefits?

Related

7条回答
  •  遥遥无期
    2020-12-29 16:19

    I wrote a blog entry a while back about when to throw different types of exceptions, and when to create new exception types. It's not that long but is probably too long to paste here so excuse me for just linking. It should cover your question about why different exception types exist, and how to know whether you need to create a custom one.

提交回复
热议问题