Skip to content

Commit

Permalink
Add type information to error message when accessing an empty packet.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 696023846
  • Loading branch information
MediaPipe Team authored and copybara-github committed Nov 13, 2024
1 parent fed2566 commit 48080cc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mediapipe/framework/api2/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,14 @@ class Packet : public Packet<internal::Generic> {
const CalculatorContext* calculator_context =
LegacyCalculatorSupport::Scoped<CalculatorContext>::current();
if (calculator_context) {
ABSL_LOG(FATAL) << absl::StrCat(
"Get() called on empty packet during execution of ",
calculator_context->NodeName(), ".");
ABSL_LOG(FATAL) << absl::StrCat("Get() called for type ",
MediaPipeTypeStringOrDemangled<T>(),
" on empty packet during execution of ",
calculator_context->NodeName(), ".");
}
ABSL_LOG(FATAL) << "Get() called on empty packet.";
ABSL_LOG(FATAL) << absl::StrCat("Get() called for type ",
MediaPipeTypeStringOrDemangled<T>(),
" on empty packet.");
}
const packet_internal::Holder<T>* typed_payload = payload_->As<T>();
ABSL_CHECK(typed_payload);
Expand Down

0 comments on commit 48080cc

Please sign in to comment.