public static JsonResponse ThrowErr(int no, string message, string errUrl) { JRespErr err = new JRespErr(); err.No = no; err.Text = message; err.Url = errUrl; JsonResponse ret = new JsonResponse(); ret.Err = err; return(ret); }
public static JsonResponse ThrowErr(SecErrs errNo, string loginUrl) { JRespErr err = new JRespErr(); err.No = (int)errNo; err.Text = SecErrMsgs.GetMessage(errNo); err.Url = loginUrl; JsonResponse ret = new JsonResponse(); ret.Err = err; return(ret); }
public static JsonResponse ThrowErr(Exception exception) { JRespErr err = new JRespErr(); err.No = (int)ServerErrs.ServerException; JsonResponse ret = new JsonResponse(); if (exception == null) { err.Text = "未知错误"; err.Url = null; ret.Err = err; return(ret); } if (exception is XUserException) { err.Text = exception.Message; err.Url = null; ret.Err = err; return(ret); } if (exception is EValidateException) { err.Text = "输入验证错误:" + exception.Message; err.Url = null; ret.Err = err; return(ret); } string s = exception.Message + "\n"; if (exception.InnerException != null) { s += exception.InnerException.Message; } if (exception.StackTrace != null) { err.ErrStack = exception.StackTrace.ToString() + "\n"; } if (exception.InnerException != null) { if (exception.InnerException.StackTrace != null) { err.ErrStack += exception.InnerException.StackTrace.ToString() + "\n"; } } err.Text = s; err.Url = null; ret.Err = err; return(ret); }