1
0
mirror of https://github.com/FreeOpcUa/freeopcua synced 2025-10-26 19:56:54 +08:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Vic Simkus
08c7205308
Merge 84a7880c19 into 6eac097563 2025-05-06 17:05:08 +00:00
Vic Simkus
84a7880c19 Added more verbose error message. Changed invalid time handling in ToString 2025-05-06 09:07:22 -05:00
2 changed files with 10 additions and 2 deletions

View File

@ -167,7 +167,7 @@ time_t DateTime::ToTimeT(DateTime dateTime)
if (dateTime.Value < secsFrom1601To1970)
{
std::stringstream stream;
stream << "OpcUa date time cannot be less than " << secsFrom1601To1970;
stream << "OpcUa date time cannot be less than " << secsFrom1601To1970 << ". Current value: " << dateTime.Value;
throw std::invalid_argument(stream.str());
}

View File

@ -423,7 +423,15 @@ std::ostream & OpcUa::ToStream(std::ostream & os, const OpcUa::Event & value, in
ToStream(os, value.EventType, true);
indent(os, subIndentLevel);
os << "Time: " << value.Time;
try
{
os << "Time: " << value.Time;
}
catch(const std::invalid_argument& e)
{
os << "Time: INVALID";
}
if (showAll)
{