コード例 #1
0
 public bool TryParse(string source, string content, out Data val, bool isDebug = false)
 {
     try {
         val = Parse(source, content);
         return(true);
     } catch (Exception e) {
         Log.ErrorOrDebug(isDebug, "Parse Failed: <{0}> {1}\n\n{2}\n\n{3}",
                          typeof(Data).FullName,
                          CaretException.GetMessage(source, e),
                          e.StackTrace, WordSplitter.AppendLineNumber(content));
     }
     val = null;
     return(false);
 }
コード例 #2
0
        public static string GetMessage(string source, Exception e)
        {
            if (e == null)
            {
                return(source);
            }
            string         msg;
            CaretException ge = e as CaretException;

            if (ge != null)
            {
                msg = ge.MessageWithCaret;
            }
            else
            {
                msg = string.Format("{0} {1} [{2}]", source, e.Message, e.GetType().FullName);
            }
            return(msg);
        }