Esempio n. 1
0
        public bool Classify(Exception classifiable)
        {
            if (classifiable == null)
            {
                return(DefaultValue);
            }

            Type exceptionType = classifiable.GetType();

            if (Classified.ContainsKey(exceptionType))
            {
                return(Classified[exceptionType]);
            }

            foreach (var type in Classified.Keys)
            {
                if (type.GetTypeInfo().IsAssignableFrom(exceptionType.GetTypeInfo()))
                {
                    bool value = Classified[type];
                    this.Classified.TryAdd(exceptionType, value);
                    return(value);
                }
            }

            return(DefaultValue);
        }