Skip to content
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

Merged
merged 6 commits into from
Oct 15, 2024

Conversation

hikinggrass
Copy link
Contributor

Describe your changes

Issue ticket number and link

Checklist before requesting a review

…-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);
Copy link
Contributor

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?

Copy link
Contributor

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

@jannejy jannejy changed the title 808 handle of invalid datetime when format check fails Handle of invalid datetime when format check fails Oct 15, 2024
@jannejy jannejy merged commit 5c7f10c into main Oct 15, 2024
4 checks passed
@jannejy jannejy deleted the 808-handle-of-invalid-datetime-when-format-check-fails branch October 15, 2024 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle of invalid DateTime when format check fails
4 participants