Err.
Inheritance: FanObj
示例#1
0
文件: LogRec.cs 项目: nomit007/f4
 public static void make_(LogRec self, DateTime time, LogLevel level, string logName, string msg, Err err)
 {
     self.m_time    = time;
       self.m_level   = level;
       self.m_logName = logName;
       self.m_msg     = msg;
       self.m_err     = err;
 }
示例#2
0
        public ActorPool join(Duration timeout)
        {
            if (!isStopped())
            {
                throw Err.make("ActorPool is not stopped").val;
            }
            long ms = timeout == null ? System.Int32.MaxValue : timeout.millis();

            try
            {
                if (m_threadPool.join(ms))
                {
                    return(this);
                }
            }
            catch (System.Threading.ThreadInterruptedException e)
            {
                throw InterruptedErr.make(e).val;
            }
            throw TimeoutErr.make("ActorPool.join timed out").val;
        }
示例#3
0
            public override Future get()
            {
                Future f = base.get();

                if (f != null)
                {
                    try
                    {
                        object key = toKey(f.m_msg);
                        if (key != null)
                        {
                            pending.Remove(key);
                        }
                    }
                    catch (System.Exception e)
                    {
                        Err.dumpStack(e);
                    }
                }
                return(f);
            }
示例#4
0
文件: Slot.cs 项目: syatanic/fantom
        public static Slot find(string qname, bool check)
        {
            string typeName, slotName;

            try
            {
                int dot = qname.IndexOf('.');
                typeName = qname.Substring(0, dot);
                slotName = qname.Substring(dot + 1);
            }
            catch (Exception)
            {
                throw Err.make("Invalid slot qname \"" + qname + "\", use <pod>::<type>.<slot>").val;
            }
            Type type = Type.find(typeName, check);

            if (type == null)
            {
                return(null);
            }
            return(type.slot(slotName, check));
        }
示例#5
0
文件: Facets.cs 项目: syatanic/fantom
        public Facet decode(Type type, string s)
        {
            try
            {
                // if no string use make/defVal
                if (s.Length == 0)
                {
                    return((Facet)type.make());
                }

                // decode using normal Fantom serialization
                return((Facet)ObjDecoder.decode(s));
            }
            catch (System.Exception e)
            {
                string msg = "ERROR: Cannot decode facet " + type + ": " + s;
                System.Console.WriteLine(msg);
                Err.dumpStack(e);
                m_map.Remove(type);
                throw IOErr.make(msg).val;
            }
        }
示例#6
0
        //////////////////////////////////////////////////////////////////////////
        // Extension
        //////////////////////////////////////////////////////////////////////////

        public static MimeType forExt(string s)
        {
            if (s == null)
            {
                return(null);
            }
            try
            {
                string val = (string)Sys.m_sysPod.props(m_etcUri, Duration.m_oneMin).get(FanStr.lower(s));
                if (val == null)
                {
                    return(null);
                }
                return(MimeType.fromStr(val));
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("MimeType.forExt: " + s);
                Err.dumpStack(e);
                return(null);
            }
        }
示例#7
0
        public virtual object get(object instance)
        {
            m_parent.finish();

            if (m_getter != null)
            {
                return(m_getter.invoke(instance, Method.noArgs));
            }

            try
            {
                return(FanUtil.box(m_reflect.GetValue(instance)));
            }
            catch (Exception e)
            {
                if (m_reflect == null)
                {
                    throw Err.make("Field not mapped to System.Reflection.FieldInfo correctly").val;
                }

                throw Err.make(e).val;
            }
        }
示例#8
0
 internal void _dispatch(Future future)
 {
     try
     {
         if (future.isCancelled())
         {
             return;
         }
         if (m_pool.m_killed)
         {
             future.cancel(); return;
         }
         future.set(receive(future.m_msg));
     }
     catch (Err.Val e)
     {
         future.err(e.m_err);
     }
     catch (System.Exception e)
     {
         future.err(Err.make(e));
     }
 }
示例#9
0
文件: Unit.cs 项目: syatanic/fantom
        //////////////////////////////////////////////////////////////////////////
        // Parsing
        //////////////////////////////////////////////////////////////////////////

        public static Unit define(string str)
        {
            // parse
            Unit unit = null;

            try
            {
                unit = parseUnit(str);
            }
            catch (Exception)
            {
                throw ParseErr.make("Unit", str).val;
            }

            // register
            lock (m_byId)
            {
                // lookup by its ids
                for (int i = 0; i < unit.m_ids.sz(); ++i)
                {
                    string id = (string)unit.m_ids.get(i);
                    if (m_byId[id] != null)
                    {
                        throw Err.make("Unit id is already defined: " + id).val;
                    }
                }

                // this is a new definition
                for (int i = 0; i < unit.m_ids.sz(); ++i)
                {
                    m_byId[(string)unit.m_ids.get(i)] = unit;
                }
                m_list.add(unit);
            }

            return(unit);
        }
示例#10
0
文件: Test.cs 项目: syatanic/fantom
 public void verifyErrMsg(Type errType, string errMsg, Func f)
 {
     try
     {
         f.call(this);
     }
     catch (Err.Val e)
     {
         if (verbose)
         {
             System.Console.WriteLine("  verifyErrMsg: " + e);
         }
         if (e.err().@typeof() != errType)
         {
             fail(e.err().@typeof() + " thrown, expected " + errType);
         }
         verifyCount++;
         verifyEq(errMsg, e.m_err.msg());
         return;
     }
     catch (System.Exception e)
     {
         if (verbose)
         {
             System.Console.WriteLine("  verifyErrMsg: " + e);
         }
         Err err = Fan.Sys.Err.make(e);
         if (err.@typeof() != errType)
         {
             fail(e.GetType() + " thrown, expected " + errType);
         }
         verifyCount++;
         verifyEq(errMsg, err.msg());
         return;
     }
     fail("No err thrown, expected " + errType);
 }
示例#11
0
        //////////////////////////////////////////////////////////////////////////
        // Handlers
        //////////////////////////////////////////////////////////////////////////

        private void inHandler()
        {
            System.IO.Stream input  = SysInStream.dotnet(m_in);
            System.IO.Stream output = m_proc.StandardInput.BaseStream;
            byte[]           temp   = new byte[256];

            while (!m_proc.HasExited)
            {
                try
                {
                    int n = input.Read(temp, 0, temp.Length);
                    if (n < 0)
                    {
                        break;
                    }
                    output.Write(temp, 0, n);
                    output.Flush();
                }
                catch (System.Exception e)
                {
                    Err.dumpStack(e);
                }
            }
        }
示例#12
0
        static TimeZone()
        {
            try
            {
                loadIndex();
            }
            catch (Exception e)
            {
                System.Console.WriteLine("ERROR: Cannot load timezone database");
                Err.dumpStack(e);
            }

            try
            {
                m_utc = fromStr("Etc/UTC");
            }
            catch (Exception e)
            {
                System.Console.WriteLine("ERROR: Cannot init UTC timezone");
                Err.dumpStack(e);

                m_utc = loadFallback("Etc/UTC", "UTC");
            }

            try
            {
                m_rel = fromStr("Etc/Rel");
            }
            catch (Exception e)
            {
                System.Console.WriteLine("ERROR: Cannot init Rel timezone");
                Err.dumpStack(e);

                m_rel = loadFallback("Etc/Rel", "Rel");
            }

            try
            {
                // first check system property
                string sysProp = (string)Env.cur().vars().get("fan.timezone");
                if (sysProp != null)
                {
                    m_cur = fromStr(sysProp);
                }

                // we assume Java default uses Olson name
                else
                {
                    // TODO - no clue how to auto map this yet
                    //cur = fromStr(java.util.TimeZone.getDefault().getID());
                    m_cur = fromStr("America/New_York");
                }
            }
            catch (Exception e)
            {
                System.Console.WriteLine("ERROR: Cannot init current timezone");
                Err.dumpStack(e);

                m_cur = m_utc;
            }
        }
示例#13
0
文件: ArgErr.cs 项目: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // C# Constructors
 //////////////////////////////////////////////////////////////////////////
 public ArgErr(Err.Val val)
     : base(val)
 {
 }
示例#14
0
 public static void make_(UnresolvedErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#15
0
文件: TestErr.cs 项目: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // C# Constructors
 //////////////////////////////////////////////////////////////////////////
 public TestErr(Err.Val val)
     : base(val)
 {
 }
示例#16
0
文件: IndexErr.cs 项目: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // C# Constructors
 //////////////////////////////////////////////////////////////////////////
 public IndexErr(Err.Val val)
     : base(val)
 {
 }
示例#17
0
        //////////////////////////////////////////////////////////////////////////
        // Lifecycle
        //////////////////////////////////////////////////////////////////////////

        public Process run()
        {
            checkRun();
            try
            {
                // arguments
                string        fileName = m_command.get(0) as string;
                StringBuilder args     = new StringBuilder();
                for (int i = 1; i < m_command.sz(); i++)
                {
                    if (i > 1)
                    {
                        args.Append(" ");
                    }
                    args.Append(m_command.get(i) as string);
                }

                // create process
                m_proc = new System.Diagnostics.Process();
                m_proc.StartInfo.UseShellExecute = false;
                m_proc.StartInfo.FileName        = fileName;
                m_proc.StartInfo.Arguments       = args.ToString();

                // environment
                if (m_env != null)
                {
                    IDictionaryEnumerator en = m_env.pairsIterator();
                    while (en.MoveNext())
                    {
                        string key = (string)en.Key;
                        string val = (string)en.Value;
                        m_proc.StartInfo.EnvironmentVariables[key] = val;
                    }
                }

                // working directory
                if (m_dir != null)
                {
                    m_proc.StartInfo.WorkingDirectory = ((LocalFile)m_dir).m_file.FullName;
                }

                // streams
                if (m_in != null)
                {
                    m_proc.StartInfo.RedirectStandardInput = true;
                }
                m_proc.StartInfo.RedirectStandardOutput = true;
                m_proc.StartInfo.RedirectStandardError  = true;
                m_proc.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(outHandler);
                m_proc.ErrorDataReceived  += new System.Diagnostics.DataReceivedEventHandler(errHandler);

                // start it
                m_proc.Start();

                // start async read/writes
                if (m_in != null)
                {
                    new System.Threading.Thread(
                        new System.Threading.ThreadStart(inHandler)).Start();
                }
                m_proc.BeginOutputReadLine();
                m_proc.BeginErrorReadLine();

                return(this);
            }
            catch (System.Exception e)
            {
                m_proc = null;
                throw Err.make(e).val;
            }
        }
示例#18
0
文件: Err.cs 项目: syatanic/fantom
 public static void make_(Err self)
 {
     make_(self, "");
 }
示例#19
0
        private Map readProps(bool listVals) // listVals is Str:Str[]
        {
            Charset origCharset = charset();

            charset(Charset.utf8());
            try
            {
                Map props = new Map(Sys.StrType, listVals ? Sys.StrType.toListOf() : Sys.StrType);

                StringBuilder name = new StringBuilder();
                StringBuilder val = null;
                int           inBlockComment = 0;
                bool          inEndOfLineComment = false;
                int           c = ' ', last = ' ';
                int           lineNum = 1;

                while (true)
                {
                    last = c;
                    c    = rChar();
                    if (c < 0)
                    {
                        break;
                    }

                    // end of line
                    if (c == '\n' || c == '\r')
                    {
                        inEndOfLineComment = false;
                        if (last == '\r' && c == '\n')
                        {
                            continue;
                        }
                        string n = FanStr.makeTrim(name);
                        if (val != null)
                        {
                            addProp(props, n, FanStr.makeTrim(val), listVals);
                            name = new StringBuilder();
                            val  = null;
                        }
                        else if (n.Length > 0)
                        {
                            throw IOErr.make("Invalid name/value pair [Line " + lineNum + "]").val;
                        }
                        lineNum++;
                        continue;
                    }

                    // if in comment
                    if (inEndOfLineComment)
                    {
                        continue;
                    }

                    // block comment
                    if (inBlockComment > 0)
                    {
                        if (last == '/' && c == '*')
                        {
                            inBlockComment++;
                        }
                        if (last == '*' && c == '/')
                        {
                            inBlockComment--;
                        }
                        continue;
                    }

                    // equal
                    if (c == '=' && val == null)
                    {
                        val = new StringBuilder();
                        continue;
                    }

                    // comment
                    if (c == '/' && FanInt.isSpace(last))
                    {
                        int peek = rChar();
                        if (peek < 0)
                        {
                            break;
                        }
                        if (peek == '/')
                        {
                            inEndOfLineComment = true; continue;
                        }
                        if (peek == '*')
                        {
                            inBlockComment++; continue;
                        }
                        unreadChar(peek);
                    }

                    // escape or line continuation
                    if (c == '\\')
                    {
                        int peek = rChar();
                        if (peek < 0)
                        {
                            break;
                        }
                        else if (peek == 'n')
                        {
                            c = '\n';
                        }
                        else if (peek == 'r')
                        {
                            c = '\r';
                        }
                        else if (peek == 't')
                        {
                            c = '\t';
                        }
                        else if (peek == '\\')
                        {
                            c = '\\';
                        }
                        else if (peek == '\r' || peek == '\n')
                        {
                            // line continuation
                            lineNum++;
                            if (peek == '\r')
                            {
                                peek = rChar();
                                if (peek != '\n')
                                {
                                    unreadChar(peek);
                                }
                            }
                            while (true)
                            {
                                peek = rChar();
                                if (peek == ' ' || peek == '\t')
                                {
                                    continue;
                                }
                                unreadChar(peek);
                                break;
                            }
                            continue;
                        }
                        else if (peek == 'u')
                        {
                            int n3 = hex(rChar());
                            int n2 = hex(rChar());
                            int n1 = hex(rChar());
                            int n0 = hex(rChar());
                            if (n3 < 0 || n2 < 0 || n1 < 0 || n0 < 0)
                            {
                                throw IOErr.make("Invalid hex value for \\uxxxx [Line " + lineNum + "]").val;
                            }
                            c = ((n3 << 12) | (n2 << 8) | (n1 << 4) | n0);
                        }
                        else
                        {
                            throw IOErr.make("Invalid escape sequence [Line " + lineNum + "]").val;
                        }
                    }

                    // normal character
                    if (val == null)
                    {
                        name.Append((char)c);
                    }
                    else
                    {
                        val.Append((char)c);
                    }
                }

                string nm = FanStr.makeTrim(name);
                if (val != null)
                {
                    addProp(props, nm, FanStr.makeTrim(val), listVals);
                }
                else if (nm.Length > 0)
                {
                    throw IOErr.make("Invalid name/value pair [Line " + lineNum + "]").val;
                }

                return(props);
            }
            finally
            {
                try { close(); } catch (System.Exception e) { Err.dumpStack(e); }
                charset(origCharset);
            }
        }
示例#20
0
 public static new ReadonlyErr make(string msg, Err cause)
 {
     ReadonlyErr err = new ReadonlyErr();
       make_(err, msg, cause);
       return err;
 }
示例#21
0
 public static void make_(ReadonlyErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#22
0
 //////////////////////////////////////////////////////////////////////////
 // C# Constructors
 //////////////////////////////////////////////////////////////////////////
 public ReadonlyErr(Err.Val val)
     : base(val)
 {
 }
示例#23
0
文件: Future.cs 项目: nomit007/f4
 internal void err(Err e)
 {
     ArrayList wd;
       lock (this)
       {
     m_state = DONE_ERR;
     m_result = e;
     Monitor.PulseAll(this);
     wd = whenDone; whenDone = null;
       }
       sendWhenDone(wd);
 }
示例#24
0
 public static void make_(FieldNotSetErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#25
0
文件: IOErr.cs 项目: syatanic/fantom
        //////////////////////////////////////////////////////////////////////////
        // C# Convenience
        //////////////////////////////////////////////////////////////////////////

        public new static IOErr make(string msg, Exception cause)
        {
            return(make(msg, Err.make(cause)));
        }
示例#26
0
文件: Err.cs 项目: syatanic/fantom
 public static void make_(Err self, string msg)
 {
     make_(self, msg, null);
 }
示例#27
0
文件: LogRec.cs 项目: syatanic/fantom
        public static LogRec make(DateTime time, LogLevel level, string logName, string msg, Err err)
        {
            LogRec self = new LogRec();

            make_(self, time, level, logName, msg, err);
            return(self);
        }
示例#28
0
文件: Err.cs 项目: syatanic/fantom
        static void doDumpStack(string msg, Exception err, int depth, StringWriter w)
        {
            // message
            for (int sp = 0; sp < depth; sp++)
            {
                w.Write(" ");
            }
            if (!(err is Err.Val) && msg == err.Message)
            {
                w.Write(err.GetType() + ": ");
            }
            w.WriteLine(msg);

            // stack
            string stack = err.StackTrace;

            if (err is Err.Val)
            {
                Err e = ((Err.Val)err).err();
                if (e.m_stack != null)
                {
                    stack = e.m_stack;
                }
            }
            if (stack != null)
            {
                string[] lines = stack.Split('\n');
                for (int i = 0; i < lines.Length; i++)
                {
                    // TODO - could be *way* more efficient

                    string s        = lines[i].Trim();
                    int    parOpen  = s.IndexOf('(');
                    int    parClose = s.IndexOf(')', parOpen);

                    string source = s.Substring(parClose + 1, s.Length - parClose - 1);
                    if (source == "")
                    {
                        source = "Unknown Source";
                    }
                    else
                    {
                        source = source.Substring(4);
                        int index = source.LastIndexOf("\\");
                        if (index != -1)
                        {
                            source = source.Substring(index + 1);
                        }
                        index  = source.LastIndexOf(":line");
                        source = source.Substring(0, index + 1) + source.Substring(index + 6);
                    }

                    string target = s.Substring(0, parOpen);
                    if (target.StartsWith("at Fan."))
                    {
                        int    a    = target.IndexOf(".", 7);
                        int    b    = target.IndexOf(".", a + 1);
                        string pod  = target.Substring(7, a - 7);
                        string type = target.Substring(a + 1, b - a - 1);
                        string meth = target.Substring(b + 1);

                        // check for closures
                        int dollar1 = type.IndexOf('$');
                        int dollar2 = dollar1 < 0 ? -1 : type.IndexOf('$', dollar1 + 1);
                        if (dollar2 > 0)
                        {
                            // don't print callX for closures
                            if (meth.StartsWith("call"))
                            {
                                continue;
                            }
                            // remap closure class back to original method
                            if (meth.StartsWith("doCall"))
                            {
                                meth = type.Substring(dollar1 + 1, dollar2 - dollar1 - 1);
                                type = type.Substring(0, dollar1);
                            }
                        }

                        target = FanStr.decapitalize(pod) + "::" + type + "." + meth;
                    }

                    for (int sp = 0; sp < depth; sp++)
                    {
                        w.Write(" ");
                    }
                    w.Write("  ");
                    w.Write(target);
                    w.Write(" (");
                    w.Write(source);
                    w.Write(")");
                    w.Write("\n");
                }
            }
            // inner exception
            Exception cause = err.InnerException;

            if (cause != null)
            {
                doDumpStack(msg, cause, depth + 1, w);
            }
        }
示例#29
0
 public static new UnsupportedErr make(string msg, Err cause)
 {
     UnsupportedErr err = new UnsupportedErr();
       make_(err, msg, cause);
       return err;
 }
示例#30
0
文件: UnknownPodErr.cs 项目: xored/f4
 //////////////////////////////////////////////////////////////////////////
 // C# Constructors
 //////////////////////////////////////////////////////////////////////////
 public UnknownPodErr(Err.Val val)
     : base(val)
 {
 }
示例#31
0
文件: IndexErr.cs 项目: nomit007/f4
 public static void make_(IndexErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#32
0
文件: UnknownPodErr.cs 项目: xored/f4
 public static new UnknownPodErr make(string msg, Err cause)
 {
     UnknownPodErr err = new UnknownPodErr();
       make_(err, msg, cause);
       return err;
 }
示例#33
0
文件: ParseErr.cs 项目: nomit007/f4
 public static new ParseErr make(string msg, Err cause)
 {
     ParseErr err = new ParseErr();
       make_(err, msg, cause);
       return err;
 }
示例#34
0
文件: UnknownPodErr.cs 项目: xored/f4
 public static void make_(UnknownPodErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#35
0
文件: NullErr.cs 项目: nomit007/f4
 public NullErr(Err.Val val)
     : base(val)
 {
 }
示例#36
0
 //////////////////////////////////////////////////////////////////////////
 // C# Constructors
 //////////////////////////////////////////////////////////////////////////
 public FieldNotSetErr(Err.Val val)
     : base(val)
 {
 }
示例#37
0
        public static TimeZone fromStr(string name, bool check)
        {
            // check cache first
            TimeZone tz;

            lock (cache)
            {
                tz = (TimeZone)cache[name];
                if (tz != null)
                {
                    return(tz);
                }
            }

            // try to load from database
            try
            {
                tz = loadTimeZone(name);
            }
            catch (Exception e)
            {
                Err.dumpStack(e);
                throw IOErr.make("Cannot load from timezone database: " + name).val;
            }

            // if not found, check aliases
            if (tz == null)
            {
                if (aliases == null)
                {
                    loadAliases();
                }
                string alias = (string)aliases[name];
                if (alias != null)
                {
                    tz = fromStr(alias); // better be found
                    lock (cache)
                    {
                        cache[tz.m_name]     = tz;
                        cache[tz.m_fullName] = tz;
                        return(tz);
                    }
                }
            }

            // if found, then cache and return
            if (tz != null)
            {
                lock (cache)
                {
                    cache[tz.m_name]     = tz;
                    cache[tz.m_fullName] = tz;
                    return(tz);
                }
            }

            // not found
            if (check)
            {
                throw ParseErr.make("TimeZone not found: " + name).val;
            }
            return(null);
        }
示例#38
0
 public static new FieldNotSetErr make(string msg, Err cause)
 {
     FieldNotSetErr err = new FieldNotSetErr();
       make_(err, msg, cause);
       return err;
 }
示例#39
0
        internal object invoke(object instance, object[] args)
        {
            if (m_reflect == null)
            {
                m_parent.finish();
            }

            try
            {
                // zero index is full signature up to using max defaults
                int index = m_params.sz() - args.Length;
                if (m_parent.dotnetRepr() && isInstance())
                {
                    index++;
                }
                if (index < 0)
                {
                    index = 0;
                }
                MethodInfo m = m_reflect[index];

                //System.Console.WriteLine(">>> " + m_reflect.Length + "/" + index);
                //System.Console.WriteLine(m_reflect[index]);
                //System.Console.WriteLine("---");
                //for (int i=0; i<m_reflect.Length; i++)
                //  System.Console.WriteLine(m_reflect[i]);

                // TODO - not sure how this should work entirely yet, but we need
                // to be responsible for "boxing" Fantom wrappers and primitives

                // box the parameters
                ParameterInfo[] pars = m.GetParameters();
                for (int i = 0; i < args.Length; i++)
                {
                    System.Type pt = pars[i].ParameterType;
                    if (pt == boolPrimitive && args[i] is Fan.Sys.Boolean)
                    {
                        args[i] = (args[i] as Fan.Sys.Boolean).booleanValue();
                    }
                    else if (pt == doublePrimitive && args[i] is Fan.Sys.Double)
                    {
                        args[i] = (args[i] as Fan.Sys.Double).doubleValue();
                    }
                    else if (pt == longPrimitive && args[i] is Fan.Sys.Long)
                    {
                        args[i] = (args[i] as Fan.Sys.Long).longValue();
                    }
                }

                // invoke method
                object ret = m.Invoke(instance, args);

                // box the return value
                return(FanUtil.box(ret));
            }
            catch (ArgumentException e)
            {
                throw ArgErr.make(e).val;
            }
            catch (TargetInvocationException e)
            {
                Err err = Err.make(e.InnerException);
                err.m_stack = e.InnerException.StackTrace;
                throw err.val;
            }
            catch (Exception e)
            {
                if (m_reflect == null)
                {
                    throw Err.make("Method not mapped to System.Reflection.MethodInfo correctly " + m_qname).val;
                }

                /*
                 * System.Console.WriteLine("ERROR:      " + signature());
                 * System.Console.WriteLine("  instance: " + instance);
                 * System.Console.WriteLine("  args:     " + (args == null ? "null" : ""+args.Length));
                 * for (int i=0; args != null && i<args.Length; ++i)
                 * System.Console.WriteLine("    args[" + i + "] = " + args[i]);
                 * Err.dumpStack(e);
                 */

                throw Err.make("Cannot call '" + this + "': " + e).val;
            }
        }
示例#40
0
 public static void make_(FieldNotSetErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#41
0
 public static void make_(UnknownServiceErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#42
0
文件: Err.cs 项目: nomit007/f4
 public static Err make(string msg, Err cause)
 {
     Err err = new Err(new Err.Val());
       make_(err, msg, cause);
       return err;
 }
示例#43
0
文件: IOErr.cs 项目: syatanic/fantom
 public static void make_(IOErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#44
0
 public static void make_(UnsupportedErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#45
0
文件: LogRec.cs 项目: syatanic/fantom
 public static void make_(LogRec self, DateTime time, LogLevel level, string logName, string msg, Err err)
 {
     self.m_time    = time;
     self.m_level   = level;
     self.m_logName = logName;
     self.m_msg     = msg;
     self.m_err     = err;
 }
示例#46
0
 public static new NotImmutableErr make(string msg, Err cause)
 {
     NotImmutableErr err = new NotImmutableErr();
       make_(err, msg, cause);
       return err;
 }
示例#47
0
 //////////////////////////////////////////////////////////////////////////
 // C# Constructors
 //////////////////////////////////////////////////////////////////////////
 public UnsupportedErr(Err.Val val)
     : base(val)
 {
 }
示例#48
0
        //////////////////////////////////////////////////////////////////////////
        // Construction
        //////////////////////////////////////////////////////////////////////////

        public static UriScheme make()
        {
            throw Err.make("UriScheme is abstract").val;
        }
示例#49
0
 public static void make_(UnsupportedErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#50
0
 //////////////////////////////////////////////////////////////////////////
 // Java Constructors
 //////////////////////////////////////////////////////////////////////////
 public InterruptedErr(Err.Val val)
     : base(val)
 {
 }
示例#51
0
文件: IndexErr.cs 项目: nomit007/f4
 public static new IndexErr make(string msg, Err cause)
 {
     IndexErr err = new IndexErr();
       make_(err, msg, cause);
       return err;
 }
示例#52
0
 public static void make_(InterruptedErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#53
0
 private long resolveNodeAddr()
 {
     try { return(resolveMacAddr()); } catch (Exception e) { Err.dumpStack(e); }
     try { return(resolveIpAddr()); } catch (Exception e) { Err.dumpStack(e); }
     return(FanInt.random());
 }
示例#54
0
        public static Service uninstall(Service self)
        {
            try
            {
                List types = FanObj.@typeof(self).inheritance();
                lock (m_lock)
                {
                    // ensure service is stopped
                    stop(self);

                    // remove from byService map, it not installed short circuit
                    if (byService[self] == null)
                    {
                        return(self);
                    }
                    byService.Remove(self);

                    // remove from map for each type implemented by service
                    for (int i = 0; i < types.sz(); ++i)
                    {
                        // get next type in inheritance and check if service type
                        Type t = (Type)types.get(i);
                        if (!isServiceType(t))
                        {
                            continue;
                        }

                        // lookup linked list for that type
                        Node node = (Node)byType[t.qname()];
                        if (node == null)
                        {
                            continue;
                        }

                        // find this thread in the linked list
                        Node last = null;
                        bool cont = false;
                        while (node.service != self)
                        {
                            last = node;
                            node = node.next;
                            if (node == null)
                            {
                                cont = true; break;
                            }
                        }
                        if (cont)
                        {
                            continue;
                        }

                        // update the map or linked list
                        if (last == null)
                        {
                            byType[t.qname()] = node.next;
                        }
                        else
                        {
                            last.next = node.next;
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                Err.dumpStack(e);
            }
            return(self);
        }
示例#55
0
文件: Err.cs 项目: nomit007/f4
 public static void make_(Err self)
 {
     make_(self, null);
 }
示例#56
0
 public static void make_(NotImmutableErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#57
0
 //////////////////////////////////////////////////////////////////////////
 // Java Constructors
 //////////////////////////////////////////////////////////////////////////
 public NotImmutableErr(Err.Val val)
     : base(val)
 {
 }
示例#58
0
文件: Err.cs 项目: nomit007/f4
 public static void make_(Err self, string msg)
 {
     make_(self, msg, null);
 }
示例#59
0
 public static void make_(NotImmutableErr self, string msg, Err cause)
 {
     Err.make_(self, msg, cause);
 }
示例#60
0
文件: Err.cs 项目: nomit007/f4
 public static void make_(Err self, string msg, Err cause)
 {
     if (msg == null) throw NullErr.make("msg is null").val;
       self.m_msg = msg;
       self.m_cause = cause;
 }