Example #1
0
 public void PersistErrorInformation(BinaryDocumentFile file, TextExtractionException exception)
 {
     try
     {
         var filePath = Path.Combine(GetCurrentAddDirectoryPath(), file.Id);
         File.Copy(file.FilePath, filePath);
         Log.Error(exception, String.Format("Persisting error document at {0}", filePath));
     }
     catch (Exception e)
     {
         Log.Error(e, String.Format("Error when persisting error information for file {0}", file.Id));
     }
 }
Example #2
0
 public void PersistErrorInformation(BinaryDocumentStream stream, TextExtractionException exception)
 {
     try
     {
         if (!stream.Stream.CanRead)
         {
             return;
         }
         var fileName = !string.IsNullOrEmpty(stream.Id)
             ? Path.GetFileName(stream.Id)
             : Guid.NewGuid().ToString();
         var filePath = Path.Combine(GetCurrentAddDirectoryPath(), fileName);
         using (var fileStream = File.Create(filePath))
         {
             stream.Stream.Seek(0, SeekOrigin.Begin);
             stream.Stream.CopyTo(fileStream);
         }
         Log.Error(exception, String.Format("Persisting error document at {0}", filePath));
     }
     catch (Exception e)
     {
         Log.Error(e, String.Format("Error when persisting error information for stream {0}", stream.Id));
     }
 }
 public ExtractedDocument(TextExtractionException exception)
 {
     ResultingDocument       = null;
     TextExtractionException = exception;
 }
 public ExtractedDocument(IDocument resultingDocument, TextExtractionException exception)
 {
     ResultingDocument       = resultingDocument;
     TextExtractionException = exception;
 }