-
-
Notifications
You must be signed in to change notification settings - Fork 17
Add TryParse to ScriptureRef #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #357 +/- ##
==========================================
- Coverage 72.49% 72.47% -0.03%
==========================================
Files 422 422
Lines 35791 35803 +12
Branches 4949 4949
==========================================
Hits 25947 25947
- Misses 8748 8760 +12
Partials 1096 1096 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ddaspit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ddaspit reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Enkidu93)
src/SIL.Machine/Corpora/ScriptureRef.cs line 53 at r1 (raw file):
return true; } catch
Is there a specific exception you can catch? Generally, it is not a good idea to use a bare catch statement, since it can mask unexpected errors.
ddaspit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Enkidu93)
src/SIL.Machine/Corpora/ScriptureRef.cs line 46 at r1 (raw file):
} public static bool TryParse(string str, out ScriptureRef scriptureRef, ScrVers versification = null)
By convention, the out parameter goes at the end. You can use overloading if you need to.
Enkidu93
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @ddaspit)
src/SIL.Machine/Corpora/ScriptureRef.cs line 46 at r1 (raw file):
Previously, ddaspit (Damien Daspit) wrote…
By convention, the
outparameter goes at the end. You can use overloading if you need to.
I was curious about default parameter + out. Yeah, overloading makes sense. Thank you! Done.
src/SIL.Machine/Corpora/ScriptureRef.cs line 53 at r1 (raw file):
Previously, ddaspit (Damien Daspit) wrote…
Is there a specific exception you can catch? Generally, it is not a good idea to use a bare catch statement, since it can mask unexpected errors.
OK, yeah, I wasn't sure if this were an exception since we really don't want TryParse to throw. I added VerseRefException.
ddaspit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ddaspit reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Enkidu93)
src/SIL.Machine/Corpora/ScriptureRef.cs line 46 at r2 (raw file):
} public static bool TryParse(string str, out ScriptureRef scriptureRef)
This method can just call the other method and pass in null for the versification parameter.
Enkidu93
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @ddaspit)
src/SIL.Machine/Corpora/ScriptureRef.cs line 46 at r2 (raw file):
Previously, ddaspit (Damien Daspit) wrote…
This method can just call the other method and pass in
nullfor theversificationparameter.
Oh yeah, good point - done
ddaspit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ddaspit reviewed 1 of 1 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Enkidu93)
Needed for sillsdev/serval#827
This change is