diff --git a/src/Orchard/Exceptions/ExceptionExtensions.cs b/src/Orchard/Exceptions/ExceptionExtensions.cs new file mode 100644 index 000000000..56cee000c --- /dev/null +++ b/src/Orchard/Exceptions/ExceptionExtensions.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Orchard.Security; +using System.Threading; +using System.Security; +using System.Runtime.InteropServices; + +namespace Orchard.Exceptions { + public static class ExceptionExtensions { + public static bool IsFatal(this Exception ex) { + return ex is OrchardSecurityException || + ex is StackOverflowException || + ex is OutOfMemoryException || + ex is AccessViolationException || + ex is AppDomainUnloadedException || + ex is ThreadAbortException || + ex is SecurityException || + ex is SEHException; + } + } +} diff --git a/src/Orchard/InvokeExtensions.cs b/src/Orchard/InvokeExtensions.cs index 395d92f04..86c67a073 100644 --- a/src/Orchard/InvokeExtensions.cs +++ b/src/Orchard/InvokeExtensions.cs @@ -1,10 +1,8 @@ using System; using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Security; -using System.Threading; -using Orchard.Logging; using Orchard.Security; +using Orchard.Logging; +using Orchard.Exceptions; namespace Orchard { @@ -26,7 +24,7 @@ namespace Orchard { ex.GetType().Name); } - if (IsFatal(ex)) { + if (ex.IsFatal()) { throw; } } @@ -34,17 +32,7 @@ namespace Orchard { } private static bool IsLogged(Exception ex) { - return ex is OrchardSecurityException || !IsFatal(ex); - } - - private static bool IsFatal(Exception ex) { - return ex is OrchardSecurityException || - ex is StackOverflowException || - ex is AccessViolationException || - ex is AppDomainUnloadedException || - ex is ThreadAbortException || - ex is SecurityException || - ex is SEHException; + return ex is OrchardSecurityException || !ex.IsFatal(); } } } diff --git a/src/Orchard/Orchard.Framework.csproj b/src/Orchard/Orchard.Framework.csproj index 69802b2a2..d53017ae2 100644 --- a/src/Orchard/Orchard.Framework.csproj +++ b/src/Orchard/Orchard.Framework.csproj @@ -210,6 +210,7 @@ +