Skip to content

Commit 9015d9e

Browse files
committed
Add project name to error
1 parent 02c6f08 commit 9015d9e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/SIL.Machine/Corpora/UsfmVersificationErrorDetector.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public UsfmVersificationError(
3030
int expectedVerse,
3131
int actualChapter,
3232
int actualVerse,
33+
string projectName,
3334
VerseRef? verseRef = null
3435
)
3536
{
@@ -39,8 +40,11 @@ public UsfmVersificationError(
3940
_actualChapter = actualChapter;
4041
_actualVerse = actualVerse;
4142
_verseRef = verseRef;
43+
ProjectName = projectName;
4244
}
4345

46+
public string ProjectName { get; private set; }
47+
4448
public UsfmVersificationErrorType Type { get; private set; }
4549

4650
// Returns true if there is an error
@@ -183,6 +187,7 @@ private string DefaultVerse(int chapter, int verse)
183187

184188
public class UsfmVersificationErrorDetector : UsfmParserHandlerBase
185189
{
190+
private readonly string _projectName;
186191
private readonly ScrVers _versification;
187192
private int _currentBook;
188193
private int _currentChapter;
@@ -191,7 +196,7 @@ public class UsfmVersificationErrorDetector : UsfmParserHandlerBase
191196

192197
public UsfmVersificationErrorDetector(ParatextProjectSettings settings)
193198
{
194-
ProjectName = settings.Name;
199+
_projectName = settings.Name;
195200
_versification = settings.Versification;
196201
_currentBook = 0;
197202
_currentChapter = 0;
@@ -200,7 +205,6 @@ public UsfmVersificationErrorDetector(ParatextProjectSettings settings)
200205
}
201206

202207
public IReadOnlyList<UsfmVersificationError> Errors => _errors;
203-
public string ProjectName { get; private set; }
204208

205209
public override void EndUsfm(UsfmParserState state)
206210
{
@@ -211,7 +215,8 @@ public override void EndUsfm(UsfmParserState state)
211215
_versification.GetLastChapter(_currentBook),
212216
_versification.GetLastVerse(_currentBook, _versification.GetLastChapter(_currentBook)),
213217
_currentChapter,
214-
_currentVerse.AllVerses().Last().VerseNum
218+
_currentVerse.AllVerses().Last().VerseNum,
219+
_projectName
215220
);
216221
if (versificationError.CheckError())
217222
_errors.Add(versificationError);
@@ -240,7 +245,8 @@ string pubNumber
240245
_currentChapter,
241246
_versification.GetLastVerse(_currentBook, _currentChapter),
242247
_currentChapter,
243-
_currentVerse.AllVerses().Last().VerseNum
248+
_currentVerse.AllVerses().Last().VerseNum,
249+
_projectName
244250
);
245251
if (versificationError.CheckError())
246252
_errors.Add(versificationError);
@@ -267,6 +273,7 @@ string pubNumber
267273
_currentVerse.AllVerses().Last().VerseNum,
268274
_currentChapter,
269275
_currentVerse.AllVerses().Last().VerseNum,
276+
_projectName,
270277
_currentVerse
271278
);
272279
if (versificationError.CheckError())

0 commit comments

Comments
 (0)