예제 #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="VLogClientSideError"/> class.
        /// from a given <see cref="JsException"/> instance and 
        /// <see cref="HttpContext"/> instance representing the HTTP 
        /// context during the exception.
        /// </summary>
        /// <param name="exception">The exception occurred on client side</param>
        public VLogClientSideError(JsException exception)
        {
            HttpContext context = HttpContext.Current;
            if (exception != null && context != null)
            {
                this.ErrorType = VLogErrorTypes.ClientSide;

                // Web Client error
                this.BrowserCapabilities = context.Request.Browser.ToDictionary();

                // Sets an object of a uniform resource identifier properties
                this.SetAdditionalHttpContextInfo(context);
                this.SetAdditionalExceptionInfo(exception);

                this.ErrorMessage = exception.Message;
                this.ErrorCode = exception.ErrorNumber.GetValueOrDefault(JsException.DefaultExceptionStatusCode);
            }
        }
 public void LogException(string exception)
 {
     if (exception.IsNotNullOrEmpty())
     {
         try
         {
             var jsproxy = exception.DeserializeFromJson<JsExceptionProxy>();
             if (jsproxy.IsValid())
             {
                 var jsexception = new JsException(jsproxy);
                 VLog.LogException(jsexception);
             }
         }
         catch (Exception ex)
         {
             VLog.Logger.InfoException(ex.Message, ex);
         }
     }
 }
예제 #3
0
파일: UnitTester.cs 프로젝트: x335/WootzJs
        public async void RunTest(UnitTest test)
        {
            try
            {
                var result = test.Method.Invoke(test.Instance, new object[0]);
                if (test.Method.ReturnType != typeof(void) && typeof(Task).IsAssignableFrom(test.Method.ReturnType))
                {
                    var task = (Task)result;
                    await task;
                }                
            }
            catch (Exception e)
            {
                test.Exception = e;
                if (e.As<JsObject>().member("GetType") == null)
                    e = new JsException(e.As<JsError>());
                Console.WriteLine(e.As<JsObject>().toString());
            }

            ReportTest(test);
        }