C# Class Python.Runtime.Exceptions

Encapsulates the Python exception APIs.
Afficher le fichier Open project: pythonnet/pythonnet Class Usage Examples

Méthodes publiques

Свойство Type Description
ArithmeticError System.IntPtr
AssertionError System.IntPtr
AttributeError System.IntPtr
BaseException System.IntPtr
DeprecationWarning System.IntPtr
EOFError System.IntPtr
EnvironmentError System.IntPtr
Exception System.IntPtr
FloatingPointError System.IntPtr
FutureWarning System.IntPtr
GeneratorExit System.IntPtr
IOError System.IntPtr
ImportError System.IntPtr
ImportWarning System.IntPtr
IndentationError System.IntPtr
IndexError System.IntPtr
KeyError System.IntPtr
KeyboardInterrupt System.IntPtr
LookupError System.IntPtr
MemoryError System.IntPtr
NameError System.IntPtr
NotImplementedError System.IntPtr
OSError System.IntPtr
OverflowError System.IntPtr
PendingDeprecationWarning System.IntPtr
ReferenceError System.IntPtr
RuntimeError System.IntPtr
RuntimeWarning System.IntPtr
StandardError System.IntPtr
StopIteration System.IntPtr
SyntaxError IntPtr
SyntaxWarning IntPtr
SystemError IntPtr
SystemExit IntPtr
TabError IntPtr
TypeError IntPtr
UnboundLocalError IntPtr
UnicodeDecodeError IntPtr
UnicodeEncodeError IntPtr
UnicodeError IntPtr
UnicodeTranslateError IntPtr
UnicodeWarning IntPtr
UserWarning IntPtr
ValueError IntPtr
Warning IntPtr
ZeroDivisionError IntPtr

Méthodes publiques

Méthode Description
Clear ( ) : void

Clear Method

Clear any exception that has been set in the Python runtime.

ErrorOccurred ( ) : bool

ErrorOccurred Method

Returns true if an exception occurred in the Python runtime. This is a wrapper for the Python PyErr_Occurred call.

ExceptionMatches ( IntPtr ob ) : bool

ExceptionMatches Method

Returns true if the current Python exception matches the given Python object. This is a wrapper for PyErr_ExceptionMatches.

ExceptionMatches ( IntPtr exc, IntPtr ob ) : bool

ExceptionMatches Method

Returns true if the given Python exception matches the given Python object. This is a wrapper for PyErr_GivenExceptionMatches.

SetError ( Exception e ) : void

SetError Method

Sets the current Python exception given a CLR exception object. The CLR exception instance is wrapped as a Python object, allowing it to be handled naturally from Python.

SetError ( IntPtr ob, IntPtr value ) : void

SetError Method

Sets the current Python exception given a Python object. This is a wrapper for the Python PyErr_SetObject call.

SetError ( IntPtr ob, string value ) : void

SetError Method

Sets the current Python exception given a native string. This is a wrapper for the Python PyErr_SetString call.

deprecation ( string message ) : void
deprecation ( string message, int stacklevel ) : void
warn ( string message, IntPtr exception ) : void
warn ( string message, IntPtr exception, int stacklevel ) : void

Alias for Python's warnings.warn() function.

Private Methods

Méthode Description
ErrorCheck ( IntPtr pointer ) : void

Shortcut for (pointer == NULL) -> throw PythonException

ErrorOccurredCheck ( IntPtr pointer ) : void

Shortcut for (pointer == NULL or ErrorOccurred()) -> throw PythonException

Exceptions ( ) : System
Initialize ( ) : void
RaiseTypeError ( string message ) : IntPtr
SetArgsAndCause ( IntPtr ob ) : void

Set the 'args' slot on a python exception object that wraps a CLR exception. This is needed for pickling CLR exceptions as BaseException_reduce will only check the slots, bypassing the __getattr__ implementation, and thus dereferencing a NULL pointer.

Shutdown ( ) : void

Method Details

Clear() public static méthode

Clear Method
Clear any exception that has been set in the Python runtime.
public static Clear ( ) : void
Résultat void

ErrorOccurred() public static méthode

ErrorOccurred Method
Returns true if an exception occurred in the Python runtime. This is a wrapper for the Python PyErr_Occurred call.
public static ErrorOccurred ( ) : bool
Résultat bool

ExceptionMatches() public static méthode

ExceptionMatches Method
Returns true if the current Python exception matches the given Python object. This is a wrapper for PyErr_ExceptionMatches.
public static ExceptionMatches ( IntPtr ob ) : bool
ob System.IntPtr
Résultat bool

ExceptionMatches() public static méthode

ExceptionMatches Method
Returns true if the given Python exception matches the given Python object. This is a wrapper for PyErr_GivenExceptionMatches.
public static ExceptionMatches ( IntPtr exc, IntPtr ob ) : bool
exc System.IntPtr
ob System.IntPtr
Résultat bool

SetError() public static méthode

SetError Method
Sets the current Python exception given a CLR exception object. The CLR exception instance is wrapped as a Python object, allowing it to be handled naturally from Python.
public static SetError ( Exception e ) : void
e System.Exception
Résultat void

SetError() public static méthode

SetError Method
Sets the current Python exception given a Python object. This is a wrapper for the Python PyErr_SetObject call.
public static SetError ( IntPtr ob, IntPtr value ) : void
ob System.IntPtr
value System.IntPtr
Résultat void

SetError() public static méthode

SetError Method
Sets the current Python exception given a native string. This is a wrapper for the Python PyErr_SetString call.
public static SetError ( IntPtr ob, string value ) : void
ob System.IntPtr
value string
Résultat void

deprecation() public static méthode

public static deprecation ( string message ) : void
message string
Résultat void

deprecation() public static méthode

public static deprecation ( string message, int stacklevel ) : void
message string
stacklevel int
Résultat void

warn() public static méthode

public static warn ( string message, IntPtr exception ) : void
message string
exception IntPtr
Résultat void

warn() public static méthode

Alias for Python's warnings.warn() function.
public static warn ( string message, IntPtr exception, int stacklevel ) : void
message string
exception IntPtr
stacklevel int
Résultat void

Property Details

ArithmeticError public_oe static_oe property

public static IntPtr,System ArithmeticError
Résultat System.IntPtr

AssertionError public_oe static_oe property

public static IntPtr,System AssertionError
Résultat System.IntPtr

AttributeError public_oe static_oe property

public static IntPtr,System AttributeError
Résultat System.IntPtr

BaseException public_oe static_oe property

public static IntPtr,System BaseException
Résultat System.IntPtr

DeprecationWarning public_oe static_oe property

public static IntPtr,System DeprecationWarning
Résultat System.IntPtr

EOFError public_oe static_oe property

public static IntPtr,System EOFError
Résultat System.IntPtr

EnvironmentError public_oe static_oe property

public static IntPtr,System EnvironmentError
Résultat System.IntPtr

Exception public_oe static_oe property

public static IntPtr,System Exception
Résultat System.IntPtr

FloatingPointError public_oe static_oe property

public static IntPtr,System FloatingPointError
Résultat System.IntPtr

FutureWarning public_oe static_oe property

public static IntPtr,System FutureWarning
Résultat System.IntPtr

GeneratorExit public_oe static_oe property

public static IntPtr,System GeneratorExit
Résultat System.IntPtr

IOError public_oe static_oe property

public static IntPtr,System IOError
Résultat System.IntPtr

ImportError public_oe static_oe property

public static IntPtr,System ImportError
Résultat System.IntPtr

ImportWarning public_oe static_oe property

public static IntPtr,System ImportWarning
Résultat System.IntPtr

IndentationError public_oe static_oe property

public static IntPtr,System IndentationError
Résultat System.IntPtr

IndexError public_oe static_oe property

public static IntPtr,System IndexError
Résultat System.IntPtr

KeyError public_oe static_oe property

public static IntPtr,System KeyError
Résultat System.IntPtr

KeyboardInterrupt public_oe static_oe property

public static IntPtr,System KeyboardInterrupt
Résultat System.IntPtr

LookupError public_oe static_oe property

public static IntPtr,System LookupError
Résultat System.IntPtr

MemoryError public_oe static_oe property

public static IntPtr,System MemoryError
Résultat System.IntPtr

NameError public_oe static_oe property

public static IntPtr,System NameError
Résultat System.IntPtr

NotImplementedError public_oe static_oe property

public static IntPtr,System NotImplementedError
Résultat System.IntPtr

OSError public_oe static_oe property

public static IntPtr,System OSError
Résultat System.IntPtr

OverflowError public_oe static_oe property

public static IntPtr,System OverflowError
Résultat System.IntPtr

PendingDeprecationWarning public_oe static_oe property

public static IntPtr,System PendingDeprecationWarning
Résultat System.IntPtr

ReferenceError public_oe static_oe property

public static IntPtr,System ReferenceError
Résultat System.IntPtr

RuntimeError public_oe static_oe property

public static IntPtr,System RuntimeError
Résultat System.IntPtr

RuntimeWarning public_oe static_oe property

public static IntPtr,System RuntimeWarning
Résultat System.IntPtr

StandardError public_oe static_oe property

public static IntPtr,System StandardError
Résultat System.IntPtr

StopIteration public_oe static_oe property

public static IntPtr,System StopIteration
Résultat System.IntPtr

SyntaxError public_oe static_oe property

public static IntPtr SyntaxError
Résultat IntPtr

SyntaxWarning public_oe static_oe property

public static IntPtr SyntaxWarning
Résultat IntPtr

SystemError public_oe static_oe property

public static IntPtr SystemError
Résultat IntPtr

SystemExit public_oe static_oe property

public static IntPtr SystemExit
Résultat IntPtr

TabError public_oe static_oe property

public static IntPtr TabError
Résultat IntPtr

TypeError public_oe static_oe property

public static IntPtr TypeError
Résultat IntPtr

UnboundLocalError public_oe static_oe property

public static IntPtr UnboundLocalError
Résultat IntPtr

UnicodeDecodeError public_oe static_oe property

public static IntPtr UnicodeDecodeError
Résultat IntPtr

UnicodeEncodeError public_oe static_oe property

public static IntPtr UnicodeEncodeError
Résultat IntPtr

UnicodeError public_oe static_oe property

public static IntPtr UnicodeError
Résultat IntPtr

UnicodeTranslateError public_oe static_oe property

public static IntPtr UnicodeTranslateError
Résultat IntPtr

UnicodeWarning public_oe static_oe property

public static IntPtr UnicodeWarning
Résultat IntPtr

UserWarning public_oe static_oe property

public static IntPtr UserWarning
Résultat IntPtr

ValueError public_oe static_oe property

public static IntPtr ValueError
Résultat IntPtr

Warning public_oe static_oe property

public static IntPtr Warning
Résultat IntPtr

ZeroDivisionError public_oe static_oe property

public static IntPtr ZeroDivisionError
Résultat IntPtr