示例#1
0
 public void Start()
 {
     try {
         if (kwargs != null)
         {
             Ops.CallWithArgsTupleAndKeywordDict(func, new object[0], new string[0], args, kwargs);
         }
         else
         {
             Ops.CallWithArgsTuple(func, new object[0], args);
         }
     } catch (Exception e) {
         Ops.Print(context.SystemState, "Unhandled exception on thread");
         Ops.Print(context.SystemState, e);
     }
 }
        /// <summary>
        /// Creates a new throwable exception of type type.
        /// </summary>
        public static Exception CreateThrowable(object type, object value)
        {
            object pyEx;

            if (Builtin.IsInstance(value, type))
            {
                pyEx = value;
            }
            else if (value is Tuple)
            {
                pyEx = Ops.CallWithArgsTuple(type, new object[0], value);
            }
            else
            {
                pyEx = Ops.Call(type, value);
            }

            return(ExceptionConverter.ToClr(pyEx));
        }