Example #1
0
        public static JsonResponse ThrowErr(Exception exception)
        {
            JRespErr err = new JRespErr();

            err.ErrNo = (int)ServerErrs.ServerException;
            JsonResponse ret = new JsonResponse();

            if (exception == null)
            {
                err.ErrText = "未知错误";
                err.ErrUrl  = null;

                ret.Err = err;
                return(ret);
            }
            if (exception is XUserException)
            {
                err.ErrText = exception.Message;
                err.ErrUrl  = null;

                ret.Err = err;
                return(ret);
            }

            if (exception is EValidateException)
            {
                err.ErrText = "输入验证错误:" + exception.Message;
                err.ErrUrl  = null;

                ret.Err = err;
                return(ret);
            }

            string s = exception.Message + "\n";

            if (exception.InnerException != null)
            {
                s += exception.InnerException.Message;
            }
            if (exception.StackTrace != null)
            {
                s += exception.StackTrace.ToString() + "\n";
            }
            if (exception.InnerException != null)
            {
                if (exception.InnerException.StackTrace != null)
                {
                    s += exception.InnerException.StackTrace.ToString() + "\n";
                }
            }

            err.ErrText = s;
            err.ErrUrl  = null;

            ret.Err = err;
            return(ret);
        }
Example #2
0
        public static JsonResponse ThrowErr(int no, string message, string errUrl)
        {
            JRespErr err = new JRespErr();

            err.ErrNo   = no;
            err.ErrText = message;
            err.ErrUrl  = errUrl;

            JsonResponse ret = new JsonResponse();

            ret.Err = err;
            return(ret);
        }
Example #3
0
        public static JsonResponse ThrowErr(SecErrs errNo, string loginUrl)
        {
            JRespErr err = new JRespErr();

            err.ErrNo   = (int)errNo;
            err.ErrText = SecErrMsgs.GetMessage(errNo);
            err.ErrUrl  = loginUrl;

            JsonResponse ret = new JsonResponse();

            ret.Err = err;
            return(ret);
        }