#18660: OutOfMemoryException as fatal and Exception.IsFatal() extension method

Work item: 18660

--HG--
branch : 1.x
extra : transplant_source : o%F2%B1%BB%C2%0C%EF%01l%90%5E%B8%0E%DD%B7%0DI%7B%11_
This commit is contained in:
piedone@pyrocenter.hu
2012-05-21 12:10:42 +02:00
parent 7b0c081bc7
commit 2f08141e7a
3 changed files with 28 additions and 16 deletions

View File

@@ -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;
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -210,6 +210,7 @@
<Compile Include="Environment\WorkContextModule.cs" />
<Compile Include="Environment\WorkContextProperty.cs" />
<Compile Include="Exceptions\DefaultExceptionPolicy.cs" />
<Compile Include="Exceptions\ExceptionExtensions.cs" />
<Compile Include="Exceptions\Filters\UnhandledExceptionFilter.cs" />
<Compile Include="Exceptions\IExceptionPolicy.cs" />
<Compile Include="FileSystems\Dependencies\IExtensionDependenciesManager.cs" />