草庐IT

CallStatus

全部标签

java - 返回异常是反模式吗?

我有两个简单的方法:publicvoidproceedWhenError(){Throwableexception=serviceUp();if(exception==null){//dostuff}else{logger.debug("Exceptionhappened,butit'salright.",exception)//dostuff}}publicvoiddoNotProceedWhenError(){Throwableexception=serviceUp();if(exception==null){//dostuff}else{//dostuffthrownewIlle

java - 返回异常是反模式吗?

我有两个简单的方法:publicvoidproceedWhenError(){Throwableexception=serviceUp();if(exception==null){//dostuff}else{logger.debug("Exceptionhappened,butit'salright.",exception)//dostuff}}publicvoiddoNotProceedWhenError(){Throwableexception=serviceUp();if(exception==null){//dostuff}else{//dostuffthrownewIlle