Detail Description
In the JAVA SDK framework, exceptions caught in the header of the eBay API SOAP request are mapped to SdkSoapException, which is extended from SdkException. The token is passed in the header in your SOAP request, hence the SdkExcetion. You can get hold of the error message and error code from the exception class captured in your try/catch block as below. The sample code snippet also retrieves an ErrorType array in the case of ApiException, as api request errors are returned in an error container that holds more than one error.
try{
.....
}catch (Exception e) {
if ( e instanceof SdkSoapException ) {
SdkSoapException sdkSoapExe = (SdkSoapException)e;
ErrorType error = sdkSoapExe.getErrorType();
System.out.println("error code: " + error.getErrorCode() + ", error shot message :" + error.getShortMessage());
}
if (e instanceof ApiException) {
ApiException apiExe = (ApiException) e;
ErrorType[] errs = apiExe.getErrors();
for (ErrorType error : errs) {
System.out.println("error code " + error.getErrorCode() + "error shot message" + error.getShortMessage());
}
}
}
The information above was based on the versions specified below:
API Schema Version | 483 |
Java SDK Version | javasdk v479.0 Full release |