Skip to content

Commit

Permalink
[core] serialization-decode-error-handling (#1673)
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky authored Jul 26, 2024
1 parent 0d361d0 commit 2c99f61
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion ecal/core/src/serialization/ecal_serialize_logging.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -157,6 +157,7 @@ namespace
if (!pb_decode(&pb_istream, eCAL_pb_LogMessage_fields, &pb_log_message))
{
std::cerr << "NanoPb eCAL::Logging::LogMessage decode failed: " << pb_istream.errmsg << '\n';
return false;
}

///////////////////////////////////////////////
Expand Down Expand Up @@ -293,6 +294,7 @@ namespace
if (!pb_decode(&pb_istream, eCAL_pb_LogMessageList_fields, &pb_log_message_list))
{
std::cerr << "NanoPb eCAL::Logging::LogMessageList decode failed: " << pb_istream.errmsg << '\n';
return false;
}

return true;
Expand Down
1 change: 1 addition & 0 deletions ecal/core/src/serialization/ecal_serialize_monitoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,7 @@ namespace
if (!pb_decode(&pb_istream, eCAL_pb_Monitoring_fields, &pb_mon_message))
{
std::cerr << "NanoPb eCAL::Monitoring::SMonitoring decode failed: " << pb_istream.errmsg << '\n';
return false;
}

return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -168,6 +168,7 @@ namespace
if (!pb_decode(&pb_istream, eCAL_pb_Sample_fields, &pb_sample))
{
std::cerr << "NanoPb eCAL::Payload::Sample decode failed: " << pb_istream.errmsg << '\n';
return false;
}

///////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -430,6 +430,7 @@ namespace
if (!pb_decode(&pb_istream, eCAL_pb_Sample_fields, &pb_sample))
{
std::cerr << "NanoPb eCAL::Registration::Sample decode failed: " << pb_istream.errmsg << '\n';
return false;
}

///////////////////////////////////////////////
Expand Down Expand Up @@ -568,6 +569,7 @@ namespace
if (!pb_decode(&pb_istream, eCAL_pb_SampleList_fields, &pb_sample_list))
{
std::cerr << "NanoPb eCAL::Registration::Sample decode failed: " << pb_istream.errmsg << '\n';
return false;
}

return true;
Expand Down
4 changes: 3 additions & 1 deletion ecal/core/src/serialization/ecal_serialize_service.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -144,6 +144,7 @@ namespace
if (!pb_decode(&pb_istream, eCAL_pb_Request_fields, &pb_request))
{
std::cerr << "NanoPb eCAL::Service::Request decode failed: " << pb_istream.errmsg << '\n';
return false;
}

///////////////////////////////////////////////
Expand Down Expand Up @@ -270,6 +271,7 @@ namespace
if (!pb_decode(&pb_istream, eCAL_pb_Response_fields, &pb_response))
{
std::cerr << "NanoPb eCAL::Service::Response decode failed: " << pb_istream.errmsg << '\n';
return false;
}

///////////////////////////////////////////////
Expand Down

0 comments on commit 2c99f61

Please sign in to comment.