예제 #1
0
        public static void ExceptionWriter(Exception ex, string inhalt)
        {
            try
            {
                if (inhalt != null)
                {
                    if (inhalt.Contains("vehicle unavailable:"))
                    {
                        Tools.Log("vehicle unavailable");
                        System.Threading.Thread.Sleep(30000);

                        return;
                    }
                    else if (inhalt.Contains("upstream internal error"))
                    {
                        Tools.Log("upstream internal error");
                        System.Threading.Thread.Sleep(10000);

                        return;
                    }
                    else if (inhalt.Contains("Connection refused"))
                    {
                        Tools.Log("Connection refused");
                        System.Threading.Thread.Sleep(30000);

                        return;
                    }
                    else if (inhalt.Contains("No route to host"))
                    {
                        Tools.Log("No route to host");
                        System.Threading.Thread.Sleep(60000);

                        return;
                    }
                }

                string temp = "";
                if (ex != null)
                {
                    temp = ex.ToString();
                }

                string prefix = GetPrefix(temp);

                if (temp.Contains("The operation has timed out"))
                {
                    Tools.Log(prefix + "HTTP Timeout");
                    System.Threading.Thread.Sleep(10000);
                    return;
                }
                else if (temp.Contains("Connection refused"))
                {
                    Tools.Log(prefix + "Connection refused");
                    System.Threading.Thread.Sleep(50000);
                    return;
                }
                else
                {
                }

                if (temp.Length > 0)
                {
                    temp += "\r\n-------------------------\r\n";
                }

                if (inhalt == null)
                {
                    temp += "NULL";
                }
                else
                {
                    temp += inhalt;
                }

                FileManager.WriteException(temp);

                System.Diagnostics.Debug.WriteLine(temp);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.ToString());
            }
        }