-
Notifications
You must be signed in to change notification settings - Fork 48
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
Handle of invalid datetime when format check fails #822
Handle of invalid datetime when format check fails #822
Conversation
Signed-off-by: Ivan Rogach <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
…-datetime-when-format-check-fails
Signed-off-by: Kai-Uwe Hermann <[email protected]>
…-datetime-when-format-check-fails # Conflicts: # CMakeLists.txt
@@ -53,8 +43,7 @@ void DateTimeImpl::from_rfc3339(const std::string& timepoint_str) { | |||
in.seekg(0); | |||
in >> date::parse("%FT%T", this->timepoint); | |||
if (in.fail()) { | |||
EVLOG_error << "Timepoint string parsing failed. Could not convert: \"" << timepoint_str | |||
<< "\" into DateTime."; | |||
throw TimePointParseException(timepoint_str); |
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.
Hmm now you added a throw where the software did not crash in the past. Did you check everywhere this is used and provide a try / catch around it if needed?
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.
Well, the std::string
constructor calls only when json is converted to the DateTime
type or in database conversions. In other places the constructor is not (should not be) called. So then it should be caught either by TimePointParseException
or std::exception
, that is done. From my side and for 2.0.1, I don't see the missing places. @hikinggrass can approve as well for 1.6
Signed-off-by: Ivan Rogach <[email protected]>
Describe your changes
Issue ticket number and link
Checklist before requesting a review