|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Throwable
java.lang.Exception
com.wolfram.jlink.MathLinkException
public class MathLinkException
The exception thrown by methods in the MathLink and KernelLink interfaces when a link error occurs.
MathLinkExceptions are only for errors that involve the low-level link itself. After you catch a MathLinkException, the first thing you should do is call clearError() to try to clear the error condition. If you do not, then the next MathLink or KernelLink method you call will throw an exception again.
For programmers familiar with the C-language MathLink API, the throwing of a MathLinkException is equivalent to a C-language function returning a result code other than MLEOK.
| Constructor Summary | |
|---|---|
MathLinkException(int code)
Creates a MathLinkException given a code. |
|
MathLinkException(int code,
java.lang.String msg)
Creates a MathLinkException given a code and textual description. |
|
MathLinkException(java.lang.Throwable e)
Creates a MathLinkException by wrapping another type of exception. |
|
MathLinkException(java.lang.Throwable e,
java.lang.String extraMsg)
Creates a MathLinkException by wrapping another type of exception. |
|
| Method Summary | |
|---|---|
java.lang.Throwable |
getCause()
Gives the other type of exception that this MathLinkException "wraps". |
int |
getErrCode()
Gives the low-level MathLink error code describing the link error. |
java.lang.String |
getMessage()
Gives the textual message describing the link error. |
java.lang.Throwable |
getWrappedException()
Gives the other type of exception that this MathLinkException "wraps". |
java.lang.String |
toString()
Gives a string representation of the exception suitable for display to a user. |
| Methods inherited from class java.lang.Throwable |
|---|
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MathLinkException(int code,
java.lang.String msg)
code - the integer error codemsg - the descriptive messagepublic MathLinkException(int code)
code - the integer error codepublic MathLinkException(java.lang.Throwable e)
This technique allows exceptions thrown by special-purpose implementations of the MathLink interface to be received and treated like they were native MathLink errors. Thus, client code does not need to be rewritten to accommodate special exception types thrown by a special type of MathLink. As an example, this is used by the RMI implementation of MathLink (not part of current standard JLink package) to wrap java.rmi.RemoteExceptions thrown by the RMI protocol.
e - the exception to wrap
public MathLinkException(java.lang.Throwable e,
java.lang.String extraMsg)
This technique allows exceptions thrown by special-purpose implementations of the MathLink interface to be received and treated like they were native MathLink errors. Thus, client code does not need to be rewritten to accommodate special exception types thrown by a special type of MathLink. As an example, this is used by the RMI implementation of MathLink (not part of current standard JLink package) to wrap java.rmi.RemoteExceptions thrown by the RMI protocol.
e - the exception to wrapextraMsg - extra textual information you want included in the output of getMessage(),
above and beyond the default of toString() of the wrapped exception.| Method Detail |
|---|
public int getErrCode()
toString(),
getMessage()public java.lang.String getMessage()
getMessage in class java.lang.ThrowabletoString()public java.lang.Throwable getWrappedException()
Some MathLinkExceptions are not "native" MathLink errors, but rather special exceptions thrown by special-purpose implementations of the MathLink interface. To allow these exceptions to be received and treated like they were native MathLink errors, yet retain their full type information, a MathLinkException can be created that "wraps" another exception. Thus, client code does not need to be rewritten to accommodate special exception types. As an example, this thechnique is used by the RMI implementation of MathLink (not part of the current standard J/Link package) to wrap java.rmi.RemoteExceptions thrown by the RMI protocol.
getCause()public java.lang.Throwable getCause()
Identical to the getWrappedException() method, but included to conform to the design pattern for "chained" exceptions introduced in Java 1.4.
getCause in class java.lang.ThrowablegetWrappedException()public java.lang.String toString()
toString in class java.lang.ThrowablegetMessage(),
getErrCode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||