Java Support Classes

prevnext

TSSException


On error, most methods throw TSSException. You call 
TSSException.getErrorCode() to get the error code. This class is shown 
below.
/*
 *
 * Java Test Script Services Exception class
 * Public methods correspond to published external TSS software C 
interfaces.
 *
 * @author DuWayne Morris
 * @version 1.0, 29-June-2000
 *
 * Modified:
 *
 *            Copyright (C) Rational Software Corporation, 2000
 *                            ALL RIGHTS RESERVED
 *
 */
package com.rational.test.tss;

import com.rational.test.tss.*;

public class TSSException extends java.lang.Exception
{

	 private int iErrRet;
	 private int iErrorCode;

	 private TSSException(int retCode, int errCode, String strError)
	 {
	 	 super(strError);
	 	 iErrRet = retCode;
	 	 iErrorCode = errCode;
	 }
	 // this is the "official" error
	 // from calling errorDetail
	 public int getErrorCode()
	 {
	 	 return iErrorCode;
	 }

	 // this is the return value from the original native
	 // method call
	 public int getReturnCode()
	 {
	 	 return iErrRet;
	 }

	 public static TSSException exception(int ret){

	 	 StringBuffer strBuf = new StringBuffer("");
	 

	 	 int i = TSSUtility.errorDetail(strBuf);

	 	 if (i != 0)
	 	 {
	 	 	 TSSException e = new TSSException(ret, i, strBuf.toString());

	 	 	 return e;
	 	 }
	 	 return null;
	 }
	 public static TSSException exception(int ret, String str){


	 	 	 TSSException e = new TSSException(ret, ret, str);

	 	 	 return e;
	 }
}

prevnext


Rational Test Script Services for Java Rational Software Corporation
Copyright (c) 2003, Rational Software Corporation http://www.rational.com
support@rational.com
info@rational.com