Add a TryGetChapters function to ScriptureRangeParser
@pmachapman is already working on this.
Since Sep 14, 2026.
Assessment
This issue has not been assessed yet.
Description
When I call ScriptureRangeParser.GetChapters(), I sometimes need to wrap it in a try/catch to ensure that any invalid chapter ranges (i.e. because a versification has changed) do not crash the method calling it, and I would rather the method just skip the range.
Does it make sense to have a ScriptureRangeParser.TryGetChapters(string scriptureRange, out Dictionary<string, List<int>> chapters) method that returns true if the chapters were retrieved, or false if they were not?
Another option could be to have a more forgiving GetChapters() implementation that will just parse the chapter ranges specified, even if they are not precisely the same as the versification requires (i.e. additional chapter numbers are in the range)
In Scripture Forge I created an extension method along the lines of:
public static bool TryGetChapters(
this ScriptureRangeParser scriptureRangeParser,
string chapterSelections,
[NotNullWhen(true)] out Dictionary<string, List<int>>? chapters
)
{
try
{
chapters = scriptureRangeParser.GetChapters(chapterSelections);
return true;
}
catch (ArgumentException)
{
chapters = null;
return false;
}
}
- Dominant language
- C#
- Stars
- 29
- Forks
- 17
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 8
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sillsdev/machine
-
Environment matchers pay for captures they never read; key the traversal on what the caller consumes Open
Difficulty 5/5 Over a week Newbie friendliness 45/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
HermitCrab: Word.ExpandAlternatives discards Unify's success flag and can null the realizational FS Open
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 5/5 Over a week Newbie friendliness 42/100
All issues in sillsdev/machine
Similar issues
-
effort:S P3 refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
nightscout/nocturne#1532 ·
-
core dependencies
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
C#/.NET Roslyn LSP Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
DotNetNext/SqlSugar#1458 ·