-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix: Throw error if invalid model specified (+ refactor) #160
Conversation
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.
Looks good to me! Even if, for some reason, this does not solve all the problem, splitting long functions with a lot of nested branches is always a good idea.
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.
Yeah, that looks much nicer. Just a couple of trivial header fixups and it's good to go!
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.
Looks good. Fire away!
Co-authored-by: James Paul Turner <[email protected]>
Co-authored-by: James Paul Turner <[email protected]>
a05182d
to
1a6c692
Compare
I've been playing around with
clang-tidy
as part of my work on #89 and it flagged a problem inmodel_parser.cpp
. The issue is that if the JSON file contains an invalid model name, although an error message is printed, the code doesn't abort and will happily register anullptr
model definition in the cache.I think part of the problem is that the
register_risk_factor_model_definitions
is rather long and with a lot of different branches in it, so it's easy to lose track of what the code is doing. I've split up the model loading into a series of separate functions with appropriate error handling in each.