private void HandleMergeException(System.Exception t, MergePolicy.OneMerge merge)
{
if (infoStream != null)
{
Message("handleMergeException: merge=" + merge.SegString(directory) + " exc=" + t);
}
// Set the exception on the merge, so if
// optimize() is waiting on us it sees the root
// cause exception:
merge.SetException(t);
AddMergeException(merge);
if (t is MergePolicy.MergeAbortedException)
{
// We can ignore this exception (it happens when
// close(false) or rollback is called), unless the
// merge involves segments from external directories,
// in which case we must throw it so, for example, the
// rollbackTransaction code in addIndexes* is
// executed.
if (merge.isExternal)
throw t;
}
else if (t is System.IO.IOException || t is System.SystemException || t is System.ApplicationException)
{
throw t;
}
else
{
// Should not get here
System.Diagnostics.Debug.Fail("Exception is not expected type!");
throw new System.SystemException(null, t);
}
}