lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject lucenenet git commit: Error handling
Date Sat, 23 Apr 2016 23:28:40 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 176d2c058 -> 47aed0858


Error handling


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/47aed085
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/47aed085
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/47aed085

Branch: refs/heads/master
Commit: 47aed085817c7d29b0fbae1b95b6c1eba0f60c30
Parents: 176d2c0
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Sun Apr 24 02:27:54 2016 +0300
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Sun Apr 24 02:27:54 2016 +0300

----------------------------------------------------------------------
 src/Lucene.Net.Core/Lucene.Net.csproj         |  1 +
 src/Lucene.Net.Core/Search/SearcherManager.cs | 10 +++++++++-
 src/Lucene.Net.Core/Support/ErrorHandling.cs  |  6 ++++++
 3 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/47aed085/src/Lucene.Net.Core/Lucene.Net.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.csproj b/src/Lucene.Net.Core/Lucene.Net.csproj
index 6ae9fd2..0d08a91 100644
--- a/src/Lucene.Net.Core/Lucene.Net.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.csproj
@@ -620,6 +620,7 @@
     <Compile Include="Support\Compatibility\Collections.cs" />
     <Compile Include="Support\ConcurrentHashMapWrapper.cs" />
     <Compile Include="Support\ConcurrentHashSet.cs" />
+    <Compile Include="Support\ErrorHandling.cs" />
     <Compile Include="Support\FileStreamExtensions.cs" />
     <Compile Include="Support\HashCodeMerge.cs" />
     <Compile Include="Support\ICallable.cs" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/47aed085/src/Lucene.Net.Core/Search/SearcherManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/SearcherManager.cs b/src/Lucene.Net.Core/Search/SearcherManager.cs
index f2eeb4a..22d87c6 100644
--- a/src/Lucene.Net.Core/Search/SearcherManager.cs
+++ b/src/Lucene.Net.Core/Search/SearcherManager.cs
@@ -1,5 +1,6 @@
 using System.Diagnostics;
 using System.IO;
+using Lucene.Net.Support;
 
 namespace Lucene.Net.Search
 {
@@ -192,13 +193,20 @@ namespace Lucene.Net.Search
         }
 
         public delegate void SearchExecutor(IndexSearcher arg);
-        public void ExecuteSearch(SearchExecutor searchFunc)
+        public void ExecuteSearch(SearchExecutor searchFunc, OnErrorDelegate onErrorFunc
= null)
         {
             var s = Acquire();
             try
             {
                 searchFunc(s);
             }
+            catch (Exception e)
+            {
+                if (onErrorFunc != null)
+                {
+                    onErrorFunc(e);
+                }
+            }
             finally
             {
                 Release(s);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/47aed085/src/Lucene.Net.Core/Support/ErrorHandling.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/ErrorHandling.cs b/src/Lucene.Net.Core/Support/ErrorHandling.cs
new file mode 100644
index 0000000..d27cb81
--- /dev/null
+++ b/src/Lucene.Net.Core/Support/ErrorHandling.cs
@@ -0,0 +1,6 @@
+´╗┐using System;
+
+namespace Lucene.Net.Support
+{
+    public delegate void OnErrorDelegate(Exception ex);
+}


Mime
View raw message