Skip to content
Snippets Groups Projects
Commit cb7e6c9c authored by Theodoros Katzalis's avatar Theodoros Katzalis
Browse files

Use a more suitable error message

parent 69a8e309
No related branches found
No related tags found
No related merge requests found
...@@ -56,6 +56,11 @@ public: ...@@ -56,6 +56,11 @@ public:
* An error in the header of a packet makes it unable to be parsed * An error in the header of a packet makes it unable to be parsed
*/ */
UnacceptablePacket = 5, UnacceptablePacket = 5,
/**
* A date that isn't valid according to Gregorian calendar (the well-known civil calendar)
*/
InvalidDate = 6,
}; };
/** /**
......
...@@ -16,12 +16,12 @@ TimeAndDate::TimeAndDate(uint16_t year, uint8_t month, uint8_t day, uint8_t hour ...@@ -16,12 +16,12 @@ TimeAndDate::TimeAndDate(uint16_t year, uint8_t month, uint8_t day, uint8_t hour
// check if the parameters makes sense // check if the parameters makes sense
// @todo change the condition of the assertion for the \p year // @todo change the condition of the assertion for the \p year
assertI(2019 <= year < 2025, ErrorHandler::InternalErrorType::UnknownInternalError); assertI(2019 <= year < 2025, ErrorHandler::InternalErrorType::InvalidDate);
assertI(1 <= month <= 12, ErrorHandler::InternalErrorType::UnknownInternalError); assertI(1 <= month <= 12, ErrorHandler::InternalErrorType::InvalidDate);
assertI(1 <= day <= 31, ErrorHandler::InternalErrorType::UnknownInternalError); assertI(1 <= day <= 31, ErrorHandler::InternalErrorType::InvalidDate);
assertI(0 <= hour <= 24, ErrorHandler::InternalErrorType::UnknownInternalError); assertI(0 <= hour <= 24, ErrorHandler::InternalErrorType::InvalidDate);
assertI(0 <= minute <= 60, ErrorHandler::InternalErrorType::UnknownInternalError); assertI(0 <= minute <= 60, ErrorHandler::InternalErrorType::InvalidDate);
assertI(0 <= second <= 60, ErrorHandler::InternalErrorType::UnknownInternalError); assertI(0 <= second <= 60, ErrorHandler::InternalErrorType::InvalidDate);
this->year = year; this->year = year;
this->month = month; this->month = month;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment