For full functionality of this site it is necessary to enable JavaScript.
Here are the instructions how to enable JavaScript in your web browser.

Knowledge base

Find the answer to your question

Advanced Search PView

Search terms
Search Type
Product
Category
Language
Format
SDK
Sort by
Direction

Getting ErrorCode programmatically in Java SDK

  • Answer ID 661
  • Published 09/05/2006 01:06 PM
  • Updated 10/20/2013 06:41 AM
  • Permalink https://ebaydts.com/eBayKBDetails?KBid=661
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

Print Email This Page Delicious Digg Facebook Reddit StumbleUpon Twitter