mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#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:
23
src/Orchard/Exceptions/ExceptionExtensions.cs
Normal file
23
src/Orchard/Exceptions/ExceptionExtensions.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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" />
|
||||
|
Reference in New Issue
Block a user