Java异常捕获/抛出
我有以下课程: BusinessException.java(是需要捕获异常并抛出它的主要异常类) BusinessExceptionInfo.javaJava异常捕获/抛出,java,exception-handling,Java,Exception Handling,我有以下课程: BusinessException.java(是需要捕获异常并抛出它的主要异常类) BusinessExceptionInfo.java public class BusinessException { protected ExceptionResponse exceptionResponse; protected String message; // getters and setters for these properties } public
public class BusinessException {
protected ExceptionResponse exceptionResponse;
protected String message;
// getters and setters for these properties
}
public class ErrorResponseItem {
protected String defaultErrorDescription;
protected List<String> descriptionVariables;
protected String errorCode;
protected SourceSystemFault sourceSystemFault;
// getter and setter methods
}
// SourceSystemFault.java
public class SourceSystemFault {
protected List<String> calloutParameters;
protected String errorCode;
protected String errorDescription;
protected String operationName;
protected String serviceName;
protected String system;
}
ExceptionResponse.java(此类保存异常消息和堆栈跟踪。此类需要使用来自异常的值填充)
如何捕获并抛出BusinessException。我是个新手,需要帮助。你能解释一下你想要实现什么吗?尝试在soap Web服务中抛出业务异常你读过Java异常教程吗?要捕获的异常在哪里?当您遇到异常时,您希望发生什么?
public class ExceptionResponse {
protected String exceptionClass;
protected String exceptionMessage;
protected List<ErrorResponseItem> errorResponseItems;
protected String stackTrace;
// getters and setters for these properties
}
public class ErrorResponseItem {
protected String defaultErrorDescription;
protected List<String> descriptionVariables;
protected String errorCode;
protected SourceSystemFault sourceSystemFault;
// getter and setter methods
}
// SourceSystemFault.java
public class SourceSystemFault {
protected List<String> calloutParameters;
protected String errorCode;
protected String errorDescription;
protected String operationName;
protected String serviceName;
protected String system;
}
public MyResponse myMethod(MyRequest req)
throws BusinessException {
}