示例#1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="obj">要输出的对象</param>
        public JsonResultEx(object obj)
        {
            this.JsonRequestBehavior = JsonRequestBehavior.AllowGet;

            if (obj is YdlCustomException)
            {
                YdlCustomException error = (YdlCustomException)obj;

                _iserror   = true;
                _errorInfo = new AjaxRequestErrorInfo {
                    errorCode = error.ErrorCode, errorType = error.ExceptionType, message = error.Message
                };
            }
            else if (obj is System.Exception)
            {
                _iserror   = true;
                _errorInfo = new AjaxRequestErrorInfo {
                    message = ((System.Exception)obj).Message
                };
            }
            else
            {
                _iserror = false;
                _obj     = obj;
            }
        }
示例#2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="exception">异常对象</param>
 public JsonResultEx(YdlCustomException exception)
     : this(exception.Message, exception.ErrorCode, exception.ExceptionType)
 {
 }