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

namespace CrazyStudio.Core.Common.Tools
{
    public static class ExceptionTool
    {
        public static string GetExceptionDescription(Exception exception, int errorCode = -1)
        {
            StringBuilder errorDesc = new StringBuilder("Exception:");
            if (exception != null)
            {
                errorDesc.Append(errorCode + exception.Message);
                if (exception.InnerException != null)
                {
                    errorDesc.Append("InnerException:" + exception.InnerException.Message);
                }
                errorDesc.Append("StackTrace:" + exception.StackTrace);
            }
            return errorDesc.ToString();
        }
    }
}
