Skip to main content
Published: September 05 2006, 1:06:00 PMUpdated: November 28 2020, 2:31:23 PM

I am getting an SdkException with ErrorCode 931 in API response. How do I get hold of the returned ErrorCode programmatically?

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());
                   }
             }

      }


Version Infor

The information above was based on the versions specified below:

API Schema Version 483
Java SDK Version javasdk v479.0 Full release

How well did this answer your question?
Answers others found helpful