Exemple #1
0
 public NoEntryError(MutableString message) : base(MakeMessage(ref message, M))
 {
     RubyExceptionData.InitializeException(this, message);
 }
Exemple #2
0
 public BadFileDescriptorError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M))
 {
     RubyExceptionData.InitializeException(this, message);
 }
Exemple #3
0
 public InvalidError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M))
 {
     RubyExceptionData.InitializeException(this, message);
 }
Exemple #4
0
 public static Exception /*!*/ Create(string /*!*/ message)
 {
     return(RubyExceptionData.InitializeException(new SocketException(0), MutableString.Create(message)));
 }
Exemple #5
0
 public static Exception /*!*/ Create(RubyClass /*!*/ self, [DefaultParameterValue(null)] object message)
 {
     return(RubyExceptionData.InitializeException(new SocketException(0), message ?? MutableString.Create("SocketError")));
 }
Exemple #6
0
        public static ExternalException /*!*/ Factory(RubyClass /*!*/ self, [DefaultProtocol] MutableString message, int errorCode)
        {
            switch (errorCode)
            {
            // TODO:
            //case 0: return RubyExceptions.CreateNOERROR();
            //case 1: return RubyExceptions.CreateEPERM();
            //case 2: return RubyExceptions.CreateENOENT(); TODO: types don't match
            //case 3: return RubyExceptions.CreateESRCH();
            //case 4: return RubyExceptions.CreateEINTR();
            //case 5: return RubyExceptions.CreateEIO();
            //case 6: return RubyExceptions.CreateENXIO();
            //case 7: return RubyExceptions.CreateE2BIG();
            //case 8: return RubyExceptions.CreateENOEXEC();
            //case 9: return RubyExceptions.CreateEBADF();     TODO: types don't match
            //case 10: return new Errno.ChildError();
            //case 11: return RubyExceptions.CreateEAGAIN();
            //case 12: return RubyExceptions.CreateENOMEM();
            //case 13: return RubyExceptions.CreateEACCES();    TODO: types don't match
            //case 14: return RubyExceptions.CreateEFAULT();
            //case 15: break;
            //case 16: return RubyExceptions.CreateEBUSY();
            //case 17: return RubyExceptions.CreateEEXIST();    TODO: types don't match
            //case 18: return RubyExceptions.CreateEXDEV();
            //case 19: return RubyExceptions.CreateENODEV();
            //case 20: return RubyExceptions.CreateENOTDIR();
            //case 21: return RubyExceptions.CreateEISDIR();
            //case 22: return RubyExceptions.CreateEINVAL();    TODO: Types don't match
            //case 23: return RubyExceptions.CreateENFILE();
            //case 24: return RubyExceptions.CreateEMFILE();
            //case 25: return RubyExceptions.CreateENOTTY();
            //case 26: break;
            //case 27: return RubyExceptions.CreateEFBIG();
            //case 28: return RubyExceptions.CreateENOSPC();
            //case 29: return RubyExceptions.CreateESPIPE();
            //case 30: return RubyExceptions.CreateEROFS();
            //case 31: return RubyExceptions.CreateEMLINK();
            //case 32: return RubyExceptions.CreateEPIPE();
            //case 33: return RubyExceptions.CreateEDOM();
            //case 34: return RubyExceptions.CreateERANGE();
            //case 35: break;
            //case 36: return RubyExceptions.CreateEDEADLK();
            //case 37: break;
            //case 38: return RubyExceptions.CreateENAMETOOLONG();
            //case 39: return RubyExceptions.CreateENOLCK();
            //case 40: return RubyExceptions.CreateENOSYS();
            //case 41: return RubyExceptions.CreateENOTEMPTY();
            //case 42: return RubyExceptions.CreateEILSEQ();

            // case 10035: return RubyExceptions.CreateEWOULDBLOCK();
            // case 10036: return RubyExceptions.CreateEINPROGRESS();
            // case 10037: return RubyExceptions.CreateEALREADY();
            // case 10038: return RubyExceptions.CreateENOTSOCK();
            // case 10039: return RubyExceptions.CreateEDESTADDRREQ();
            // case 10040: return RubyExceptions.CreateEMSGSIZE();
            // case 10041: return RubyExceptions.CreateEPROTOTYPE();
            // case 10042: return RubyExceptions.CreateENOPROTOOPT();
            // case 10043: return RubyExceptions.CreateEPROTONOSUPPORT();
            // case 10044: return RubyExceptions.CreateESOCKTNOSUPPORT();
            // case 10045: return RubyExceptions.CreateEOPNOTSUPP();
            // case 10046: return RubyExceptions.CreateEPFNOSUPPORT();
            // case 10047: return RubyExceptions.CreateEAFNOSUPPORT();
            case 10048: return(new Errno.AddressInUseError());

            // case 10049: return RubyExceptions.CreateEADDRNOTAVAIL();
            // case 10050: return RubyExceptions.CreateENETDOWN();
            // case 10051: return RubyExceptions.CreateENETUNREACH();
            // case 10052: return RubyExceptions.CreateENETRESET();
            case 10053: return(new Errno.ConnectionAbortedError());

            case 10054: return(new Errno.ConnectionResetError());

            // case 10055: return RubyExceptions.CreateENOBUFS();
            // case 10056: return RubyExceptions.CreateEISCONN();
            case 10057: return(new Errno.NotConnectedError());

            // case 10058: return RubyExceptions.CreateESHUTDOWN();
            // case 10059: return RubyExceptions.CreateETOOMANYREFS();
            // case 10060: return RubyExceptions.CreateETIMEDOUT();
            case 10061: return(new Errno.ConnectionRefusedError());

            // case 10062: return RubyExceptions.CreateELOOP();
            case 10064: return(new Errno.HostDownError());
                // case 10065: return RubyExceptions.CreateEHOSTUNREACH();
                // case 10068: return RubyExceptions.CreateEUSERS();
                // case 10069: return RubyExceptions.CreateEDQUOT();
                // case 10070: return RubyExceptions.CreateESTALE();
                // case 10071: return RubyExceptions.CreateEREMOTE();
            }

#if SILVERLIGHT
            ExternalException result = new ExternalException(RubyExceptions.MakeMessage(ref message, "Unknown Error"));
#else
            ExternalException result = new ExternalException(RubyExceptions.MakeMessage(ref message, "Unknown Error"), errorCode);
#endif
            RubyExceptionData.InitializeException(result, message);
            return(result);
        }
Exemple #7
0
 public ResourceTemporarilyUnavailableError(MutableString message) : base(RubyExceptions.MakeMessage(ref message, M))
 {
     RubyExceptionData.InitializeException(this, message);
 }
Exemple #8
0
        public static object dosync_source(RubyModule /*!*/ self, params object[] args)
        {
            object res = null;

            try
            {
                int    nSrcID  = 0;
                String strName = "";

                if (args[0] is  long)
                {
                    nSrcID = (int)(long)args[0];
                }
                else if (args[0] is int)
                {
                    nSrcID = (int)args[0];
                }
                else
                {
                    strName = ((MutableString)args[0]).ToString();
                }

                /*if (srcID is long)
                 *  nSrcID = (int)(long)srcID;
                 * else if (srcID is int)
                 *  nSrcID = (int)srcID;
                 * else
                 *  strName = srcID.ToString();*/

                boolean bShowStatus  = true;
                String  query_params = "";
                if (args != null && args.Length > 1)
                {
                    if (args[1] is int)
                    {
                        bShowStatus = ((int)args[1]).Equals(1);
                    }
                    else
                    {
                        String str = ((MutableString)args[1]).ToString();
                        //bShowStatus = args[0].Equals(RubyConstant.QTRUE)||"true".equalsIgnoreCase(str);
                        bShowStatus = "true".equalsIgnoreCase(str);
                    }
                }

                if (args != null && args.Length > 2)
                {
                    query_params = ((MutableString)args[2]).ToString();
                }

                SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncOne, strName, nSrcID, bShowStatus, query_params));

                res = SyncThread.getInstance().getRetValue();
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("dosync_source", ex);
                throw rubyEx;
            }

            return(res);
        }