Skip to content

Commit

Permalink
Use StrCat for string concatenation (#1270)
Browse files Browse the repository at this point in the history
This makes the code compatible with a future Protobuf release where various methods return absl::string_view instead of std::string or const std::string&.

Signed-off-by: Yury Kats <[email protected]>
  • Loading branch information
yurykats authored Jan 1, 2025
1 parent 4c5e006 commit 9569ed9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions source/adaptive_load/adaptive_load_client_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ uint32_t AdaptiveLoadClientMain::Run() {
ENVOY_LOG(info, "Attempting adaptive load session: {}", DescribeInputs());
absl::StatusOr<std::string> spec_textproto = filesystem_.fileReadToEnd(spec_filename_);
if (!spec_textproto.ok()) {
throw Nighthawk::NighthawkException("Failed to read spec textproto file \"" + spec_filename_ +
"\": " + std::string(spec_textproto.status().message()));
throw Nighthawk::NighthawkException(absl::StrCat("Failed to read spec textproto file \"",
spec_filename_,
"\": ", spec_textproto.status().message()));
}

nighthawk::adaptive_load::AdaptiveLoadSessionSpec spec;
if (!Envoy::Protobuf::TextFormat::ParseFromString(*spec_textproto, &spec)) {
throw Nighthawk::NighthawkException("Unable to parse file \"" + spec_filename_ +
"\" as a text protobuf (type " + spec.GetTypeName() + ")");
throw Nighthawk::NighthawkException(absl::StrCat("Unable to parse file \"", spec_filename_,
"\" as a text protobuf (type ",
spec.GetTypeName(), ")"));
}
std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(
nighthawk_service_address_, use_tls_ ? grpc::SslCredentials(grpc::SslCredentialsOptions())
Expand Down

0 comments on commit 9569ed9

Please sign in to comment.