Exemple #1
0
        public static SystemExit /*!*/ Factory(RubyClass /*!*/ self, [Optional] int status, [DefaultParameterValue(null)] object message)
        {
            SystemExit result = new SystemExit(status, RubyExceptionData.GetClrMessage(self, message ?? "SystemExit"));

            RubyExceptionData.InitializeException(result, message);
            return(result);
        }
Exemple #2
0
        public static MissingMethodException /*!*/ Factory(
            RubyClass /*!*/ self,
            [DefaultParameterValue(null)] object message,
            [DefaultParameterValue(null)] object name,
            [DefaultParameterValue(null)] object args)
        {
            MissingMethodException result = new MissingMethodException(RubyExceptionData.GetClrMessage(self, message ?? "NoMethodError"));

            RubyExceptionData.InitializeException(result, message);
            // Exception.Data requires the value to be Serializable. We workaround this using an array
            // of size 1 since System.Array is serializable. This will allow the exception to be marshalled.
            // If the value cannot actually be marshalled, it will fail only if the value is later accessed.
#if SILVERLIGHT
            result.Data[typeof(NoMethodErrorOps)] = new object[1] {
                args
            };
#else
            result.Data[typeof(NoMethodErrorOps)] = new ObjectHandle[1] {
                new ObjectHandle(args)
            };
#endif
            return(result);
        }
Exemple #3
0
 public static string /*!*/ GetClrMessage(RubyClass /*!*/ exceptionClass, object message)
 {
     return(RubyExceptionData.GetClrMessage(exceptionClass.Context, message));
 }