应该将异常放在单独的包中吗? [英] Should Exceptions be placed in a separate package?

查看:102
本文介绍了应该将异常放在单独的包中吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进行一个项目,其中所有的例外都被放在一个单独的包com.myco.myproj.exceptions中。



这是个好习惯吗?

解决方案

用于包中存在该包。例如

  com.oopsconsultancy.models.pricing 

将包含定价模型和相关例外。还有一点似乎有点反直觉。


I am taking on a project where all the Exceptions have been placed in a separate package com.myco.myproj.exceptions.

Is this good practice?

解决方案

I would expect the exceptions for a package to exist within that package. e.g.

com.oopsconsultancy.models.pricing

would contain pricing models and related exceptions. Anything else seems a bit counter-intuitive.

这篇关于应该将异常放在单独的包中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆