C# Class IronPython.Runtime.Exceptions.PythonExceptions

Implementation of the Python exceptions module and the IronPython/CLR exception mapping mechanism. The exception module is the parent module for all Python exception classes and therefore is built-in to IronPython.dll instead of IronPython.Modules.dll. The exception mapping mechanism is exposed as internal surface area available to only IronPython / IronPython.Modules.dll. The actual exceptions themselves are all public. Because the oddity of the built-in exception types all sharing the same physical layout (see also PythonExceptions.BaseException) some classes are defined as classes w/ their proper name and some classes are defined as PythonType fields. When a class is defined for convenience their's also an _TypeName version which is the PythonType.
显示文件 Open project: jschementi/iron Class Usage Examples

Private Methods

Method Description
CreatePythonThrowable ( IronPython.Runtime.Types.PythonType type ) : BaseException
CreateSubType ( IronPython.Runtime.PythonContext context, IronPython.Runtime.Types.PythonType baseType, Type underlyingType, string name, string module, string documentation, Exception>.Func exceptionMaker ) : IronPython.Runtime.Types.PythonType
CreateSubType ( IronPython.Runtime.PythonContext context, IronPython.Runtime.Types.PythonType baseType, string name, string module, string documentation, Exception>.Func exceptionMaker ) : IronPython.Runtime.Types.PythonType
CreateSubType ( IronPython.Runtime.Types.PythonType baseType, Type concreteType, Exception>.Func exceptionMaker ) : IronPython.Runtime.Types.PythonType

Creates a new type for a built-in exception which is the root concrete type.

CreateSubType ( IronPython.Runtime.Types.PythonType baseType, string name, Exception>.Func exceptionMaker ) : IronPython.Runtime.Types.PythonType

Creates a new type for a built-in exception which derives from another Python type. . These types are built-in and immutable like any other normal type. For example StandardError.x = 3 is illegal. This isn't for module exceptions which are like user defined types. thread.error.x = 3 is legal.

CreateThrowable ( IronPython.Runtime.Types.PythonType type ) : Exception
CreateThrowableForRaise ( CodeContext context, OldClass type, object value ) : Exception
CreateThrowableForRaise ( CodeContext context, IronPython.Runtime.Types.PythonType type, object value ) : Exception
GetDynamicStackFrames ( Exception e ) : DynamicStackFrame[]

Gets the list of DynamicStackFrames for the current exception.

GetFrameList ( this e ) : List
GetPythonException ( this e ) : object

Internal helper to get the associated Python exception from a .NET exception.

GetTraceBack ( this e ) : IronPython.Runtime.Exceptions.TraceBack
MethodsMatch ( MethodBase method, MethodBase other ) : bool
RemoveFrameList ( this e ) : void
RemoveTraceBack ( this e ) : void
SetFrameList ( this e, List frames ) : void
SetPythonException ( this e, object exception ) : void

Internal helper to associate a .NET exception and a Python exception.

SetTraceBack ( this e, IronPython.Runtime.Exceptions.TraceBack traceback ) : void
SyntaxErrorToPython ( SyntaxErrorException e ) : BaseException

Converts the DLR SyntaxErrorException into a Python new-style SyntaxError instance.

ToClr ( object pythonException ) : Exception

Returns the CLR exception associated with a Python exception creating a new exception if necessary

ToPython ( System clrException ) : object

Given a CLR exception returns the Python exception which most closely maps to the CLR exception.

ToPythonNewStyle ( System clrException ) : BaseException

Creates a new style Python exception from the .NET exception