public class PyException extends 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,
String value) |
Modifier and Type | Method and Description |
---|---|
static PyException |
doRaise(PyObject type,
PyObject value,
PyObject traceback)
Logic for the raise statement
|
static String |
exceptionClassName(PyObject obj)
Get the name of the exception's class
|
Throwable |
fillInStackTrace() |
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(PrintStream s) |
boolean |
refersDirectlyTo(PyObject ob)
Optional operation.
|
void |
super__printStackTrace(PrintWriter w) |
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,
Object arg)
Traverses all reachable
PyObject s. |
addSuppressed, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace
public PyObject type
public PyObject value
public PyTraceback traceback
public PyException()
public PyException(PyObject type)
public PyException(PyObject type, PyObject value, PyTraceback traceback)
public void printStackTrace()
printStackTrace
in class Throwable
public Throwable fillInStackTrace()
fillInStackTrace
in class Throwable
public void printStackTrace(PrintStream s)
printStackTrace
in class Throwable
public void super__printStackTrace(PrintWriter w)
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 String exceptionClassName(PyObject obj)
obj
- a PyObject exceptionpublic int traverse(Visitproc visit, Object arg)
Traverseproc
PyObject
s.
Like in CPython, arg
must be passed
unmodified to visit
as its second parameter.
If visit.visit
returns nonzero, this return value
must be returned immediately by traverse.traverse
in interface Traverseproc
public boolean refersDirectlyTo(PyObject ob)
Traverseproc
traverse
with a visitproc
that just watches out for ob
.
Must return false
if ob
is null
.refersDirectlyTo
in interface Traverseproc