| 297 | } |
| 298 | |
| 299 | bool Message::onDecodeError( |
| 300 | std::string_view message, int fieldNumber, const Byte* data, size_t length, ExceptionTracker& exceptionTracker) { |
| 301 | auto descriptorName = _descriptor != nullptr ? _descriptor->full_name() : "<Unknown>"; |
| 302 | std::string errorMessage = |
| 303 | fmt::format("In message type '{}' and field number {}: {}", descriptorName, fieldNumber, message); |
| 304 | |
| 305 | if (snap::kIsDevBuild || snap::kIsGoldBuild) { |
| 306 | auto logger = Valdi::strongSmallRef(kLogger); |
| 307 | if (logger != nullptr) { |
| 308 | VALDI_ERROR(*logger, "Message failed to decode: {}", errorMessage); |
| 309 | VALDI_ERROR( |
| 310 | *logger, "{} payload content: {}", descriptorName, snap::utils::encoding::binaryToBase64(data, length)); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | exceptionTracker.onError(std::move(errorMessage)); |
| 315 | return false; |
| 316 | } |
| 317 | |
| 318 | bool Message::decode(const Byte* data, size_t length, ExceptionTracker& exceptionTracker) { |
| 319 | google::protobuf::io::CodedInputStream inputStream(data, static_cast<int>(length)); |
nothing calls this directly
no test coverage detected