我一般在项目里,业务层的方法报错都会直接往上抛到控制层来做统一的处理,一般来说,有经验的开发者会选择这样的异常处理方法吗? 如果不这样做,那么一般怎样做?
Why should we throw it into the control layer? Different field types will affect your business direction, so I usually unified convergence exceptions at the service layer.
When there is a transaction, I will throw the exception to the control layer for processing, otherwise it may affect the rollback of the transaction
Usually it is handled directly in the service
Why should we throw it into the control layer? Different field types will affect your business direction, so I usually unified convergence exceptions at the service layer.
When there is a transaction, I will throw the exception to the control layer for processing, otherwise it may affect the rollback of the transaction
Usually it is handled directly in the service