beautypg.com

2 java interface exception class, Java interface exception class – Metrohm 846 Driver Toolbox User Manual

Page 32

background image

3.1 Programming interface definitions

28

Dosing Interface USB Toolbox, Annex

3.1.2 Java interface exception class

/*

* Copyright(c) 2005 Metrohm AG

* created date: 09.06.2005

* $Archive:

/tools/846_usb_dll/src/java_wrapper_846/src/metr/DosIntFace846Exception.jav

a $

* $Date: 9.06.05 15:46 $

* $Author: Km $

* $Revision: 2 $

*/

package metr;

/**

*

* @author Michael Keller

* @version 1.2.5.0, 09/06/05

*/

/**

* Exception class for 846 Dosing Interface communication

*

* Specification of the error code number:

* 1: not a valid 846 Dosing Interface number or Dosino number

* 2: not a valid Dosino

* 3: communication error

* 4: function arguments out of specified range

* 5: not a valid action

*/

public class DosIntFace846Exception extends Exception{

private int nErrorCode;

public DosIntFace846Exception(String s,int nErrorCode) {

super(s);

this.nErrorCode = nErrorCode;

}

public int getErrorCode() {

return nErrorCode;

}

public static String getErrorString(int nErrorCode) {

switch (nErrorCode) {

case 0: return "method could be set up correctly";

case 1: return "not a valid 846 Dosing Interface number or

Dosino number";

case 2: return "not a valid Dosino";

case 3: return "communication error";

case 4: return "function arguments out of specified range";

case 5: return "not a valid action";

default: return "unknown error code";

}

}

}

/*