Default language.

Exception handling


Errors are modeled through the ARException class. All error messages that the  returns are generated as an ARException in the  Java API. Warnings and informational status messages are not treated as exceptions, but are available using the getLastStatus method of the ARServerUser class.

Refer to the following example of using the getLastStatus method:

        try {           
login();           
int[] fields = new int[] { 1, 8, 536870914
};           
Entry entry = serverUser.getEntry("SomeForm", "ENT000000001", fields);       
//code to process entry after successful retrieval
       } catch (ARException ex) {           
List<StatusInfo> sis = ex.getLastStatus();           
boolean found = false;           
for (Iterator<StatusInfo> it = sis.iterator(); it.hasNext();) {
           StatusInfo
statusInfo = it.next();               
if (statusInfo.getMessageNum() ==
ARErrors.AR_ERROR_NO_ACCESS_TO_SCHEMA) {                   
found = true;                  
//code to process as per permission error                   
break;               
} else if (statusInfo.getMessageNum() ==
ARErrors.AR_ERROR_NO_SUCH_ENTRY) {                   
found = true;                   
//code to process as per invalid entry id or no permission to the entry                   
break;               
}           
}        
if (!found) {               
throw ex;           
}
        }
finally {           
logout();
     }

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*