using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XKRS.Common.Model.Helper
{
    public enum ExceptionLevel
    {
        Info=0,
        Warning=1,
        Fatal=2,
    }

    public class ProcessException : Exception
    {
        public ExceptionLevel Level { get; set; } = ExceptionLevel.Warning;

        public ProcessException(string error, Exception ex = null, ExceptionLevel lvl = ExceptionLevel.Warning)
        {
            Level = lvl;
            ExceptionNotice();
        }
        public void ExceptionNotice()
        {

        }
    }




    public static class ExceptionHelper
    {

        public static string GetExceptionMessage(this Exception ex)
        {
            string msg = "异常信息：" + ex.Message;
            //当前异常不为空
            if (ex.InnerException != null)
            {
                msg += "；\t内部异常信息：" + ex.InnerException.GetExceptionMessage();
            }
            return msg;
        }
    }
}
