diff --git a/inc/ErrorHandler.hpp b/inc/ErrorHandler.hpp index adffdc132bffd5aa7830bcbd414f415a643c6340..bd89fd331cd072d9055f98763455519b5c203691 100644 --- a/inc/ErrorHandler.hpp +++ b/inc/ErrorHandler.hpp @@ -56,6 +56,11 @@ public: * An error in the header of a packet makes it unable to be parsed */ UnacceptablePacket = 5, + + /** + * A date that isn't valid according to Gregorian calendar (the well-known civil calendar) + */ + InvalidDate = 6, }; /** diff --git a/src/Helpers/TimeAndDate.cpp b/src/Helpers/TimeAndDate.cpp index 2fbf5b85d50256110cd8cb0600d12b4561d0e86a..59b604a6e7e516e15621decf4613f2b97fb79c8b 100644 --- a/src/Helpers/TimeAndDate.cpp +++ b/src/Helpers/TimeAndDate.cpp @@ -16,12 +16,12 @@ TimeAndDate::TimeAndDate(uint16_t year, uint8_t month, uint8_t day, uint8_t hour // check if the parameters makes sense // @todo change the condition of the assertion for the \p year - assertI(2019 <= year < 2025, ErrorHandler::InternalErrorType::UnknownInternalError); - assertI(1 <= month <= 12, ErrorHandler::InternalErrorType::UnknownInternalError); - assertI(1 <= day <= 31, ErrorHandler::InternalErrorType::UnknownInternalError); - assertI(0 <= hour <= 24, ErrorHandler::InternalErrorType::UnknownInternalError); - assertI(0 <= minute <= 60, ErrorHandler::InternalErrorType::UnknownInternalError); - assertI(0 <= second <= 60, ErrorHandler::InternalErrorType::UnknownInternalError); + assertI(2019 <= year < 2025, ErrorHandler::InternalErrorType::InvalidDate); + assertI(1 <= month <= 12, ErrorHandler::InternalErrorType::InvalidDate); + assertI(1 <= day <= 31, ErrorHandler::InternalErrorType::InvalidDate); + assertI(0 <= hour <= 24, ErrorHandler::InternalErrorType::InvalidDate); + assertI(0 <= minute <= 60, ErrorHandler::InternalErrorType::InvalidDate); + assertI(0 <= second <= 60, ErrorHandler::InternalErrorType::InvalidDate); this->year = year; this->month = month;