java.lang.Exception vs. rolling your own exception

后端 未结 10 1198
无人及你
无人及你 2020-12-13 14:30

At what point would you create your own exception class vs. using java.lang.Exception? (All the time? Only if it will be used outside the package? Only if it must contain ad

10条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-13 15:24

    IF there is an existing Exception with the language runtime or libraries, use it ELSE create your own, document it well and that should work in 99% of the cases.

提交回复
热议问题