Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UmbracoException"/> class.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="innerException">The inner exception.</param>
 public UmbracoException(string message, Exception innerException)
     : base(message, innerException)
 {
     // get the calling assembly
     Assembly assembly = new StackFrame(1).GetMethod().ReflectedType.Assembly;
     string assemblyName = assembly.FullName.Split(",".ToCharArray())[0];
     // try to determine the component
     try
     {
         string componentName = assemblyName.ToLower().Replace("umbraco.", String.Empty);
         m_Component = (UmbracoComponent)Enum.Parse(typeof(UmbracoComponent), componentName, true);
     }
     // do nothing if parsing fails, default value is UmbracoComponent.External
     catch (ArgumentException) { }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UmbracoException"/> class.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="innerException">The inner exception.</param>
        public UmbracoException(string message, Exception innerException)
            : base(message, innerException)
        {
            // get the calling assembly
            Assembly assembly     = new StackFrame(1).GetMethod().ReflectedType.Assembly;
            string   assemblyName = assembly.FullName.Split(",".ToCharArray())[0];

            // try to determine the component
            try
            {
                string componentName = assemblyName.ToLower().Replace("umbraco.", String.Empty);
                m_Component = (UmbracoComponent)Enum.Parse(typeof(UmbracoComponent), componentName, true);
            }
            // do nothing if parsing fails, default value is UmbracoComponent.External
            catch (ArgumentException) { }
        }