public class PyException extends java.lang.RuntimeException implements Traverseproc
type
field and value or class instance is stored in the value
field.Modifier and Type | Field and Description |
---|---|
PyTraceback |
traceback
The exception traceback object.
|
PyObject |
type
The python exception class (for class exception) or identifier (for string exception).
|
PyObject |
value
The exception instance (for class exception) or exception value (for string exception).
|
Constructor and Description |
---|
PyException() |
PyException(PyObject type) |
PyException(PyObject type,
PyObject value) |
PyException(PyObject type,
PyObject value,
PyTraceback traceback) |
PyException(PyObject type,
java.lang.String value) |
Modifier and Type | Method and Description |
---|---|
static PyException |
doRaise(PyObject type,
PyObject value,
PyObject traceback)
Logic for the raise statement
|
static java.lang.String |
exceptionClassName(PyObject obj)
Get the name of the exception's class
|
java.lang.Throwable |
fillInStackTrace() |
java.lang.String |
getMessage() |
static boolean |
isExceptionClass(PyObject obj)
Determine whether obj is a Python exception class
|
static boolean |
isExceptionInstance(PyObject obj)
Determine whether obj is an Python exception instance
|
boolean |
match(PyObject exc)
Determine if this PyException is a match for exc.
|
void |
normalize()
Instantiates the exception value if it is not already an
instance.
|
void |
printStackTrace() |
void |
printStackTrace(java.io.PrintStream s) |
boolean |
refersDirectlyTo(PyObject ob)
Optional operation.
|
void |
super__printStackTrace(java.io.PrintWriter w) |
java.lang.String |
toString() |
void |
tracebackHere(PyFrame here)
Register frame as having been visited in the traceback.
|
void |
tracebackHere(PyFrame here,
boolean isFinally)
Register frame as having been visited in the traceback.
|
int |
traverse(Visitproc visit,
java.lang.Object arg)
Traverses all directly contained
PyObject s. |
public PyObject type
public PyObject value
public PyTraceback traceback
public PyException()
public PyException(PyObject type)
public PyException(PyObject type, PyObject value, PyTraceback traceback)
public PyException(PyObject type, java.lang.String value)
public void printStackTrace()
printStackTrace
in class java.lang.Throwable
public java.lang.Throwable fillInStackTrace()
fillInStackTrace
in class java.lang.Throwable
public java.lang.String getMessage()
getMessage
in class java.lang.Throwable
public void printStackTrace(java.io.PrintStream s)
printStackTrace
in class java.lang.Throwable
public void super__printStackTrace(java.io.PrintWriter w)
public java.lang.String toString()
toString
in class java.lang.Throwable
public void normalize()
public void tracebackHere(PyFrame here)
here
- the current PyFramepublic void tracebackHere(PyFrame here, boolean isFinally)
here
- the current PyFrameisFinally
- whether caller is a Python finally blockpublic static PyException doRaise(PyObject type, PyObject value, PyObject traceback)
type
- the first arg to raise, a type or an instancevalue
- the second arg, the instance of the class or arguments to its
constructortraceback
- a traceback objectpublic boolean match(PyObject exc)
exc
- a PyObject exception typepublic static boolean isExceptionClass(PyObject obj)
obj
- a PyObjectpublic static boolean isExceptionInstance(PyObject obj)
obj
- a PyObjectpublic static java.lang.String exceptionClassName(PyObject obj)
obj
- a PyObject exceptionpublic int traverse(Visitproc visit, java.lang.Object arg)
Traverseproc
PyObject
s.
Like in CPython, arg
must be passed
unmodified to visit
as its second parameter.
If Visitproc.visit(PyObject, Object)
returns
nonzero, this return value
must be returned immediately by traverse.
Visitproc.visit(PyObject, Object)
must not be
called with a null
PyObject-argument.traverse
in interface Traverseproc
public boolean refersDirectlyTo(PyObject ob)
Traverseproc
Traverseproc.traverse(Visitproc, Object)
with
a visitproc that just watches out for ob
.
Must return false
if ob
is null
.refersDirectlyTo
in interface Traverseproc