public static MessageResponsePage <T> SetExceptionPage <T>(Exception ex) { MessageResponsePage <T> rValue = new MessageResponsePage <T>(); if (ex is BusinessException || ex is ApplicationException) { BusinessException bEx = ex as BusinessException; rValue.Code = bEx.ErrorCode; rValue.Message = ex.Message; LogTxt.WriteLog("BusinessException" + bEx.ErrorCode, (int)LogType.Other); } else { rValue.Code = ServerErrcodeEnum.ServiceError;//系统异常 rValue.Message = "服务未处理异常"; Exception logException = ex; if (ex.InnerException != null) { logException = ex.InnerException; } LogTxt.WriteLog("BusinessException" + logException.Message, (int)LogType.Other); } return(rValue); }
public static MessageResponsePage <T> SetResponsePage <T>(T obj) { MessageResponsePage <T> mr = new MessageResponsePage <T>(); mr.Code = ServerErrcodeEnum.Normal; mr.Message = ""; return(mr); }