@@ -108,7 +108,8 @@ int main(int argc, char **argv)
108
108
return a.exec ();
109
109
#ifndef DEBUG_LP
110
110
}
111
- catch ( const InvalidConfiguration& e ) {
111
+ catch ( const InvalidConfiguration& e )
112
+ {
112
113
std::cerr << " Catched InvalidConfiguration: " << e.what () << std::endl;
113
114
return UNSUPPORTED_LANGUAGE;
114
115
}
@@ -447,6 +448,7 @@ int run(int argc, char** argv)
447
448
std::cerr << " No file to analyze." << std::endl;
448
449
}
449
450
451
+
450
452
uint64_t nfile=0 ;
451
453
for (const auto & file : files)
452
454
{
@@ -521,14 +523,30 @@ int run(int argc, char** argv)
521
523
<< " (" << percent.toUtf8 ().constData ()
522
524
<< " %) lines. At " << qfile.pos ();
523
525
}
524
-
526
+ #ifndef DEBUG_LP
527
+ try {
528
+ #endif
525
529
// analyze it
526
530
client->analyze (contentText,
527
531
metaData,
528
532
pipeline,
529
533
handlers,
530
534
inactiveUnits);
531
-
535
+ #ifndef DEBUG_LP
536
+ }
537
+ catch (const LinguisticProcessingException& e) {
538
+ std::cerr << " LinguisticProcessing error on line " << lineNum << " ["
539
+ << contentText.toStdString () << " ]:" << e.what ()
540
+ << std::endl;
541
+ // allows the process to continue on next line
542
+ }
543
+ catch (const LimaException& e) {
544
+ std::cerr << " Error on line " << lineNum << " ["
545
+ << contentText.toStdString () << " ]:" << e.what ()
546
+ << std::endl;
547
+ // allows the process to continue on next line
548
+ }
549
+ #endif
532
550
}
533
551
qfile.close ();
534
552
}
@@ -564,19 +582,30 @@ int run(int argc, char** argv)
564
582
// analyze it with the proper offset
565
583
paragraph.append (" \n " );
566
584
paraMetaData[" StartOffset" ]=std::to_string (prevpos);
585
+ #ifndef DEBUG_LP
567
586
try {
587
+ #endif
588
+ // analyze it
568
589
client->analyze (paragraph,
569
590
paraMetaData,
570
591
pipeline,
571
592
handlers,
572
593
inactiveUnits);
594
+ #ifndef DEBUG_LP
595
+ }
596
+ catch (const LinguisticProcessingException& e) {
597
+ std::cerr << " LinguisticProcessing error on paragraph " << numpar << " ["
598
+ << paragraph.toStdString () << " ]:" << e.what ()
599
+ << std::endl;
600
+ // allows the process to continue on next paragraph
573
601
}
574
- catch (LimaException& e) {
602
+ catch (const LimaException& e) {
575
603
std::cerr << " Error on paragraph " << numpar << " ["
576
604
<< paragraph.toStdString () << " ]:" << e.what ()
577
605
<< std::endl;
578
606
// allows the process to continue on next paragraph
579
607
}
608
+ #endif
580
609
}
581
610
pos += sep.matchedLength ();
582
611
prevpos=pos;
@@ -601,8 +630,24 @@ int run(int argc, char** argv)
601
630
TimeUtils::logElapsedTime (" ReadInputFile" );
602
631
TimeUtils::updateCurrentTime ();
603
632
604
- // analyze it
605
- client->analyze (contentText, metaData, pipeline, handlers, inactiveUnits);
633
+ #ifndef DEBUG_LP
634
+ try {
635
+ #endif
636
+ // analyze it
637
+ client->analyze (contentText, metaData, pipeline, handlers, inactiveUnits);
638
+ #ifndef DEBUG_LP
639
+ }
640
+ catch (const LinguisticProcessingException& e) {
641
+ std::cerr << " LinguisticProcessing error on document " << file << " :" << e.what ()
642
+ << std::endl;
643
+ // allows the process to continue on next file
644
+ }
645
+ catch (const LimaException& e) {
646
+ std::cerr << " Error on document " << file << " :" << e.what ()
647
+ << std::endl;
648
+ // allows the process to continue to next file
649
+ }
650
+ #endif
606
651
}
607
652
608
653
// Close and delete opened output files
0 commit comments