AwbUpdater.ErrorHandler.Thrower C# (CSharp) Метод

Thrower() публичный статический Метод

Returns the name of our function where supposedly error resides; it's the last non-framework function in the stack
public static Thrower ( Exception ex ) : string
ex System.Exception Exception to process
Результат string
        public static string Thrower(Exception ex)
        {
            string[] trace = MethodNames(ex.StackTrace);

            if (trace.Length == 0)
            {
                return "unknown function";
            }

            string res = "";
            foreach (string t in trace)
            {
                if (PresetNamespaces.Any(ns => t.StartsWith(ns)))
                {
                    res = trace[0];
                }
                else
                {
                    res = t;
                    break;
                }
            }

            // strip namespace for clarity
            var res2 = Regex.Match(res, @"\w+\.{1,2}\w+$").Value;
            if (res2.Length > 0)
            {
                return res2;
            }

            return res;
        }