【发布时间】:2013-08-30 00:14:08
【问题描述】:
代码(Java)sn-p
.....
.....
if ( response.check() == checkNumber )
{
String message = "You are looking at Wrong Place";
logger.log( message );
throw new UserAtWrongPlaceException( message );
/* stops here */
}
.....
...
if ( response.check() == somethingElse)
{
......
}
我有代码来检查响应,如果响应等于定义的常量 checkNumber,我想记录消息并抛出异常,但这样做我的代码执行将在此时停止,而不是继续进行。
记录我的消息的更好方法是什么,抛出 UserAtWrongPlaceException 并继续 执行其余代码?
【问题讨论】:
标签: java exception logging exception-handling