/// <summary>
/// Lưu lại thông tin lỗi vào tập tin error.txt; description: ghi chú đi kèm theo lỗi
/// </summary>
/// <param name="ex"></param>
/// <param name="description"></param>
/// <returns>Trả lại thông báo lỗi</returns>
public static string saveMessage(this Exception ex, string description = "")
{
ex.getLine().saveError(description);
var serverName = "";
if (HttpContext.Current != null)
{
try {
serverName = $"{HttpContext.Current.Request.ServerVariables["SERVER_NAME"]}";
if (Regex.IsMatch(serverName, "localhost", RegexOptions.IgnoreCase))
{
return(ex.getLine().Replace(Folders.pathApp, "").Replace("\n", "<br />") + "<br />" + description);
}
} catch { }
}
return(ex.Message);
}