Esempio n. 1
0
 /// <summary>
 /// 获取基于当前用户语言的错误内容(同步)
 /// </summary>
 /// <param name="exception"></param>
 /// <returns></returns>
 public static string GetCurrentLcidMessageSync(this Exception exception)
 {
     if (exception is UtilityException)
     {
         var lcid = ContextContainer.GetValue <int>(ContextTypes.CurrentUserLcid);
         return(((UtilityException)exception).Fragment.GetLanguageTextSync(lcid));
     }
     else
     {
         return(exception.Message);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 获取基于当前用户语言的错误内容
 /// </summary>
 /// <param name="exception"></param>
 /// <returns></returns>
 public static async Task <string> GetCurrentLcidMessage(this Exception exception)
 {
     if (exception is UtilityException)
     {
         var lcid = ContextContainer.GetValue <int>(ContextTypes.CurrentUserLcid);
         return(await((UtilityException)exception).Fragment.GetLanguageText(lcid));
     }
     else
     {
         return(await Task.FromResult(exception.Message));
     }
 }