Exemplo n.º 1
0
        private static Exception FromPyErr(BorrowedReference typeRef, BorrowedReference valRef, BorrowedReference tbRef,
                                           out ExceptionDispatchInfo?exceptionDispatchInfo)
        {
            if (valRef == null)
            {
                throw new ArgumentNullException(nameof(valRef));
            }

            var type      = PyType.FromReference(typeRef);
            var value     = new PyObject(valRef);
            var traceback = PyObject.FromNullableReference(tbRef);

            exceptionDispatchInfo = TryGetDispatchInfo(valRef);
            if (exceptionDispatchInfo != null)
            {
                return(exceptionDispatchInfo.SourceException);
            }

            if (ManagedType.GetManagedObject(valRef) is CLRObject {
                inst : Exception e
            })