mev-4.0.01/source/org/tigr/microarray/mev/r/RSrvException.java

Code
Comments
Other
Rev Date Author Line
2 26 Feb 07 jari 1 //
2 26 Feb 07 jari 2 //  RSrvException.java
2 26 Feb 07 jari 3 //  Klimt
2 26 Feb 07 jari 4 //
2 26 Feb 07 jari 5 //  Created by Simon Urbanek on Mon Aug 18 2003.
2 26 Feb 07 jari 6 //  Copyright (c) 2003 __MyCompanyName__. All rights reserved.
2 26 Feb 07 jari 7 //
2 26 Feb 07 jari 8 //  $Id$
2 26 Feb 07 jari 9 //
2 26 Feb 07 jari 10
2 26 Feb 07 jari 11 package org.tigr.microarray.mev.r;
2 26 Feb 07 jari 12
2 26 Feb 07 jari 13 public class RSrvException extends Exception {
2 26 Feb 07 jari 14     protected Rconnection conn;
2 26 Feb 07 jari 15     protected String err;
2 26 Feb 07 jari 16     protected int reqReturnCode;
2 26 Feb 07 jari 17
2 26 Feb 07 jari 18     public String getRequestErrorDescription() {
2 26 Feb 07 jari 19         switch(reqReturnCode) {
2 26 Feb 07 jari 20             case 0: return "no error";
2 26 Feb 07 jari 21             case 2: return "R parser: input incomplete";
2 26 Feb 07 jari 22             case 3: return "R parser: syntax error";
2 26 Feb 07 jari 23             case Rtalk.ERR_auth_failed: return "authorization failed";
2 26 Feb 07 jari 24             case Rtalk.ERR_conn_broken: return "connection broken";
2 26 Feb 07 jari 25             case Rtalk.ERR_inv_cmd: return "invalid command";
2 26 Feb 07 jari 26             case Rtalk.ERR_inv_par: return "invalid parameter";
2 26 Feb 07 jari 27             case Rtalk.ERR_IOerror: return "I/O error on the server";
2 26 Feb 07 jari 28             case Rtalk.ERR_not_open: return "connection is not open";
2 26 Feb 07 jari 29             case Rtalk.ERR_access_denied: return "access denied (local to the server)";
2 26 Feb 07 jari 30             case Rtalk.ERR_unsupported_cmd: return "unsupported command";
2 26 Feb 07 jari 31             case Rtalk.ERR_unknown_cmd: return "unknown command";
2 26 Feb 07 jari 32             case Rtalk.ERR_data_overflow: return "data overflow, incoming data too big";
2 26 Feb 07 jari 33             case Rtalk.ERR_object_too_big: return "evaluation successful, but returned object is too big to transport";
2 26 Feb 07 jari 34             case Rtalk.ERR_out_of_mem: return "FATAL: Rserve ran out of memory, closing connection";
2 26 Feb 07 jari 35         }
2 26 Feb 07 jari 36         return "Error ("+reqReturnCode+")";
2 26 Feb 07 jari 37     }
2 26 Feb 07 jari 38
2 26 Feb 07 jari 39     public String getMessage() {
2 26 Feb 07 jari 40         return super.getMessage()+" [request status: "+getRequestErrorDescription()+"]";
2 26 Feb 07 jari 41     }
2 26 Feb 07 jari 42     
2 26 Feb 07 jari 43     public RSrvException(Rconnection c, String msg) {
2 26 Feb 07 jari 44         this(c,msg,0);
2 26 Feb 07 jari 45     }
2 26 Feb 07 jari 46
2 26 Feb 07 jari 47     public RSrvException(Rconnection c, String msg, int requestReturnCode) {
2 26 Feb 07 jari 48         super(msg);
2 26 Feb 07 jari 49         conn=c; reqReturnCode=requestReturnCode;
2 26 Feb 07 jari 50     }
2 26 Feb 07 jari 51
2 26 Feb 07 jari 52     public int getRequestReturnCode() {
2 26 Feb 07 jari 53         return reqReturnCode;
2 26 Feb 07 jari 54     }
2 26 Feb 07 jari 55 }