Java Exceptions

Most method calls to classes in the com.sqribe.rm.* package throw a ReportMartException, which is an Exception class derived from the standard java.lang.Exception class. Throwing exceptions is the normal mechanism used in the APIs to communicate a negative result from a method invocation. To avoid providing countless subclasses of ReportMartException to cover all possible failure scenarios, the ReportMartException classes are limited, with most subclasses related to login processing:

All calls to API methods must be enclosed in a try/catch block, as seen in this example code that shows how to log on to EPM Workspace:

import com.sqribe.rm.*;
public class TestSDK
{
static Session theSession = null;
public static void main(Strings [] args)
{
// assume that args contains username, password and host
try
{
theSession = SessionFactory.getInstance(args[0], args[1], args[2]);
...
... your code goes here
...
}
catch (UnknownReportMartException e1)
{
// unable to connect to specified host
System.out.println(e1.getMessage());
}
catch (UserValidationException e2)
{
// invalid account or password
System.out.println(e2.getMessage());
}
}
}