public class OPeNDAPException
extends java.lang.Exception
Modifier and Type | Field and Description |
---|---|
static int |
CANNOT_READ_FILE
The file specified by the OPeNDAP URL can not be read.
|
static int |
MALFORMED_EXPR
The expression specified in the OPeNDAP URL is not valid.
|
static int |
NO_AUTHORIZATION
The user has no authorization to read the OPeNDAP URL.
|
static int |
NO_SUCH_FILE
The file specified by the OPeNDAP URL does not exist.
|
static int |
NO_SUCH_VARIABLE
The variable specified in the OPeNDAP URL does not exist.
|
static int |
UNDEFINED_ERROR
Undefined error.
|
static int |
UNKNOWN_ERROR
Unknown error.
|
Constructor and Description |
---|
OPeNDAPException()
Construct an empty
OPeNDAPException . |
OPeNDAPException(int code,
java.lang.String msg)
Construct a
OPeNDAPException with the given message. |
OPeNDAPException(java.lang.String msg)
Construct a
OPeNDAPException . |
OPeNDAPException(java.lang.String msg,
java.lang.Throwable cause)
Construct a
OPeNDAPException . |
OPeNDAPException(java.lang.Throwable cause)
Construct a
OPeNDAPException . |
Modifier and Type | Method and Description |
---|---|
static void |
anyExceptionHandler(java.lang.Throwable t,
javax.servlet.http.HttpServletResponse response)
************************************************************************
Recasts any Throwable to be an OPeNDAPException and then transmits it
on to the passed stream as a DAP2 error object.
|
static java.lang.String |
getDAP2Error(int errorCode,
java.lang.String errorMessage) |
static org.jdom.Document |
getDAP32Error(int errorCode,
java.lang.String errorMessage) |
int |
getErrorCode()
Returns the error code.
|
java.lang.String |
getErrorMessage()
Returns the error message.
|
java.lang.String |
getMessage()
Returns the detail message of this throwable object.
|
void |
print(java.io.OutputStream os)
Print the DAP2 Error object on the given
OutputStream . |
void |
print(java.io.PrintWriter os)
Print the DAP2 Error object on the given
PrintWriter . |
void |
setErrorCode(int code)
Sets the error code.
|
void |
setErrorMessage(java.lang.String msg)
Sets the error message.
|
public static final int UNDEFINED_ERROR
public static final int UNKNOWN_ERROR
public static final int NO_SUCH_FILE
public static final int NO_SUCH_VARIABLE
public static final int MALFORMED_EXPR
public static final int NO_AUTHORIZATION
public static final int CANNOT_READ_FILE
public OPeNDAPException()
OPeNDAPException
.public OPeNDAPException(java.lang.String msg)
OPeNDAPException
.msg
- A message describing the error.public OPeNDAPException(java.lang.String msg, java.lang.Throwable cause)
OPeNDAPException
.msg
- A message describing the error.cause
- The cause (which is saved for later retrieval by the
Throwable.getCause() method). (A null value is permitted, and indicates
that the cause is nonexistent or unknown.)public OPeNDAPException(java.lang.Throwable cause)
OPeNDAPException
.cause
- The cause (which is saved for later retrieval by the
Throwable.getCause() method). (A null value is permitted, and indicates
that the cause is nonexistent or unknown.)public OPeNDAPException(int code, java.lang.String msg)
OPeNDAPException
with the given message.code
- the error coremsg
- the error messagepublic final int getErrorCode()
public final java.lang.String getErrorMessage()
public java.lang.String getMessage()
getMessage
in class java.lang.Throwable
public final void setErrorCode(int code)
code
- the error code.public final void setErrorMessage(java.lang.String msg)
msg
- the error message.public static java.lang.String getDAP2Error(int errorCode, java.lang.String errorMessage)
public void print(java.io.PrintWriter os)
PrintWriter
.
This code can be used by servlets to throw an OPeNDAPException to a client.os
- the PrintWriter
to use for output.public final void print(java.io.OutputStream os)
OutputStream
.os
- the OutputStream
to use for output.print(PrintWriter)
public static void anyExceptionHandler(java.lang.Throwable t, javax.servlet.http.HttpServletResponse response)
t
- The Exception that caused the problem.response
- The HttpServletResponse
for the client.public static org.jdom.Document getDAP32Error(int errorCode, java.lang.String errorMessage)
errorCode
- errorMessage
-