Exemplo n.º 1
0
        private void ParseFromBacktrace(MutableString message, RubyArray backtrace)
        {
            m_message = message.ToString();

            var trace        = backtrace.Cast <MutableString>().Select((line) => line.ToString().Trim());
            var rubyPathLine =
                from line in trace
                let match = Regex.Match(line, @"(.*\.rb):(\d+)(:in\s+(.*))?$")
                            let groupCnt = match.Groups.Count
                                           where match.Success
                                           let innerLoc = match.Groups[4].Value
                                                          select new
            {
                FilePath = match.Groups[1].Value,
                FileLine = int.Parse(match.Groups[2].Value),
                InnerLoc = String.IsNullOrEmpty(innerLoc) ? "<top>" : innerLoc
            };

            var infoObj = rubyPathLine.FirstOrDefault();

            if (infoObj != null)
            {
                m_hasInfo = true;
                m_format  = ErrorMessageFormat.Error;
                m_message = String.Format("{0} (in {1})", m_message, infoObj.InnerLoc);
                m_path    = infoObj.FilePath;
                m_line    = infoObj.FileLine;
            }
        }
Exemplo n.º 2
0
        private void ParseFromBacktrace(MutableString message, RubyArray backtrace)
        {
            m_message = message.ToString();

              var trace = backtrace.Cast<MutableString>().Select((line) => line.ToString().Trim());
              var rubyPathLine =
            from line in trace
            let match = Regex.Match(line, @"(.*\.rb):(\d+)(:in\s+(.*))?$")
            let groupCnt = match.Groups.Count
            where match.Success
            let innerLoc = match.Groups[4].Value
            select new
            {
              FilePath = match.Groups[1].Value,
              FileLine = int.Parse(match.Groups[2].Value),
              InnerLoc = String.IsNullOrEmpty(innerLoc) ? "<top>" : innerLoc
            };

              var infoObj = rubyPathLine.FirstOrDefault();
              if (infoObj != null)
              {
            m_hasInfo = true;
            m_format = ErrorMessageFormat.Error;
            m_message = String.Format("{0} (in {1})", m_message, infoObj.InnerLoc);
            m_path = infoObj.FilePath;
            m_line = infoObj.FileLine;
              }
        }