Exemplo n.º 1
0
        /// <summary>
        /// CSS minification error handler
        /// </summary>
        /// <param name="source">The source of the event</param>
        /// <param name="args">A Microsoft.Ajax.Utilities.ContextErrorEventArgs
        /// that contains the event data</param>
        public void CssMinificationErrorHandler(object source, ContextErrorEventArgs args)
        {
            ContextError error = args.Error;

            if (error.Severity <= 2)
            {
                var errorDetails = new MinificationErrorInfo(error.Message, error.StartLine, error.StartColumn, string.Empty);
                if (error.IsError)
                {
                    _errors.Add(errorDetails);
                }
                else
                {
                    _warnings.Add(errorDetails);
                }
            }
        }
Exemplo n.º 2
0
        public static InstanceClassDispatcher AssetClass(TagTestItem item, CodeIteratorMapping ivk)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            if (item._0001() == WatcherComposer.None && !item._0001())
            {
                throw ContextError.CheckComposer(item, "Error reading JArray from JsonReader.");
            }
            item.RevertError();
            if (item._0001() != WatcherComposer.StartArray)
            {
                throw ContextError.CheckComposer(item, "Error reading JArray from JsonReader. Current JsonReader item is not an array: {0}".ListReader(CultureInfo.InvariantCulture, item._0001()));
            }
            InstanceClassDispatcher instanceClassDispatcher = new InstanceClassDispatcher();

            instanceClassDispatcher.TestClass(item as IdentifierClientBridge, ivk);
            instanceClassDispatcher.CollectClass(item, ivk);
            return(instanceClassDispatcher);
        }
Exemplo n.º 3
0
        public static WatcherIssuer OrderRequest(TagTestItem info, CodeIteratorMapping selection)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            if (info._0001() == WatcherComposer.None && !info._0001())
            {
                throw ContextError.CheckComposer(info, "Error reading JProperty from JsonReader.");
            }
            info.RevertError();
            if (info._0001() != WatcherComposer.PropertyName)
            {
                throw ContextError.CheckComposer(info, "Error reading JProperty from JsonReader. Current JsonReader item is not a property: {0}".ListReader(CultureInfo.InvariantCulture, info._0001()));
            }
            WatcherIssuer watcherIssuer = new WatcherIssuer((string)info._0001());

            watcherIssuer.TestClass(info as IdentifierClientBridge, selection);
            watcherIssuer.CollectClass(info, selection);
            return(watcherIssuer);
        }
Exemplo n.º 4
0
        public static IndexerReaderMapper WriteClass(TagTestItem setup, CodeIteratorMapping reg)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            if (setup._0001() == WatcherComposer.None && !setup._0001())
            {
                throw ContextError.CheckComposer(setup, "Error reading JConstructor from JsonReader.");
            }
            setup.RevertError();
            if (setup._0001() != WatcherComposer.StartConstructor)
            {
                throw ContextError.CheckComposer(setup, "Error reading JConstructor from JsonReader. Current JsonReader item is not a constructor: {0}".ListReader(CultureInfo.InvariantCulture, setup._0001()));
            }
            IndexerReaderMapper indexerReaderMapper = new IndexerReaderMapper((string)setup._0001());

            indexerReaderMapper.TestClass(setup as IdentifierClientBridge, reg);
            indexerReaderMapper.CollectClass(setup, reg);
            return(indexerReaderMapper);
        }
Exemplo n.º 5
0
        public static DecoratorReaderMapper VerifyRequest(TagTestItem config, CodeIteratorMapping col)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            ContextClientBridge.RunClient(config, "reader");
            if (config._0001() == WatcherComposer.None && !config._0001())
            {
                throw ContextError.CheckComposer(config, "Error reading JObject from JsonReader.");
            }
            config.RevertError();
            if (config._0001() != WatcherComposer.StartObject)
            {
                throw ContextError.CheckComposer(config, "Error reading JObject from JsonReader. Current JsonReader item is not an object: {0}".ListReader(CultureInfo.InvariantCulture, config._0001()));
            }
            DecoratorReaderMapper decoratorReaderMapper = new DecoratorReaderMapper();

            decoratorReaderMapper.TestClass(config as IdentifierClientBridge, col);
            decoratorReaderMapper.CollectClass(config, col);
            return(decoratorReaderMapper);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 异常发生后(没有被catch),会进到这里
        /// </summary>
        /// <param name="actionExecutedContext"></param>
        public override void OnException(HttpActionExecutedContext actionExecutedContext)
        {
            Stream stream = actionExecutedContext.Request.Content.ReadAsStreamAsync().Result;

            stream.Position = 0;
            var       reader       = new StreamReader(stream, Encoding.UTF8);
            string    method       = actionExecutedContext.Request.Method.Method;         //请求类型
            string    errorMsg     = actionExecutedContext.Exception.Message;             //错误信息
            string    requstResult = reader.ReadToEnd();                                  //前端调用参数
            string    requestUrl   = actionExecutedContext.Request.RequestUri.ToString(); // 请求路径
            string    stackTrace   = actionExecutedContext.Exception.StackTrace;          //堆栈信息
            string    requestIp    = "";
            DDContext context      = new DDContext();

            ContextError contextError = new ContextError()
            {
                ErrorMsg     = errorMsg,
                RequstResult = requstResult,
                Method       = method,
                RequestIp    = requestIp,
                RequestUrl   = requestUrl,
                StackTrace   = stackTrace,
                CreateTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
            };

            context.ContextError.Add(contextError);
            context.SaveChanges();
            this.logger.Error($"在响应 {requestUrl} 时出现异常,信息:{errorMsg},详见数据库日志Id:{contextError.Id}");

            actionExecutedContext.Response = actionExecutedContext.Request.CreateResponse(
                System.Net.HttpStatusCode.OK, new NewErrorModel
            {
                error = new Error(1, $"出现异常,请联系管理员! 错误Id:{contextError.Id}", "")
                {
                },
            });

            //base.OnException(actionExecutedContext);
            //ExceptionHandler
        }
        /// <summary>
        /// Generates a detailed error message based on object ContextError
        /// </summary>
        /// <param name="error">Object ContextError</param>
        /// <returns>Detailed error message</returns>
        internal static string FormatContextError(ContextError error)
        {
            var errorMessage = new StringBuilder();

            errorMessage.AppendFormatLine("{0}: {1}", CoreStrings.ErrorDetails_Message, error.Message);
            errorMessage.AppendFormatLine("{0}: {1}", CoreStrings.ErrorDetails_ErrorCode, error.ErrorCode);
            errorMessage.AppendFormatLine("{0}: {1}", CoreStrings.ErrorDetails_Severity, error.Severity);
            errorMessage.AppendFormatLine("{0}: {1}", CoreStrings.ErrorDetails_Subcategory, error.Subcategory);
            if (!string.IsNullOrWhiteSpace(error.HelpKeyword))
            {
                errorMessage.AppendFormatLine("{0}: {1}", CoreStrings.ErrorDetails_HelpKeyword, error.HelpKeyword);
            }
            if (!string.IsNullOrWhiteSpace(error.File))
            {
                errorMessage.AppendFormatLine("{0}: {1}", CoreStrings.ErrorDetails_File, error.File);
            }
            errorMessage.AppendFormatLine("{0}: {1}", CoreStrings.ErrorDetails_StartLine, error.StartLine);
            errorMessage.AppendFormatLine("{0}: {1}", CoreStrings.ErrorDetails_StartColumn, error.StartColumn);
            errorMessage.AppendFormatLine("{0}: {1}", CoreStrings.ErrorDetails_EndLine, error.EndLine);
            errorMessage.AppendFormat("{0}: {1}", CoreStrings.ErrorDetails_EndColumn, error.EndColumn);

            return(errorMessage.ToString());
        }
 public JScriptExceptionEventArgs(JScriptException exception, ContextError error)
 {
     Error = error;
     Exception = exception;
 }
Exemplo n.º 9
0
        internal static Dictionary <string, string> GetPatientAttributes(string value, ContextError error)
        {
            try
            {
                var parts = ContextParser.SplitField(value, error);

                var patientAttributes = new Dictionary <string, string>();

                foreach (var part in parts)
                {
                    var attribute = Split(part, new[] { '=' }, error);
                    attribute[0].AssertEnum <ContextStandard.Patient.PatientParameter>(ContextError.InvalidPatient);

                    patientAttributes.Add(attribute[0].Trim(), attribute[1].Trim());
                }

                return(patientAttributes);
            }
            catch
            {
                throw new ContextException(error);
            }
        }
Exemplo n.º 10
0
 private static List <string> SplitField(string value, ContextError error)
 {
     return(Split(value, s_fieldSeparator, error));
 }
Exemplo n.º 11
0
		public override void OnError(ContextError arg0)
		{
			UnityEngine.Debug.Log(string.Format("An error occured! {0} (#{1})", arg0.Error, arg0.ErrorCode));
		}