Skip to content

Commit 9569ed9

Browse files
authored
Use StrCat for string concatenation (#1270)
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 <yurykats@yahoo.com>
1 parent 4c5e006 commit 9569ed9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

source/adaptive_load/adaptive_load_client_main.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,16 @@ uint32_t AdaptiveLoadClientMain::Run() {
104104
ENVOY_LOG(info, "Attempting adaptive load session: {}", DescribeInputs());
105105
absl::StatusOr<std::string> spec_textproto = filesystem_.fileReadToEnd(spec_filename_);
106106
if (!spec_textproto.ok()) {
107-
throw Nighthawk::NighthawkException("Failed to read spec textproto file \"" + spec_filename_ +
108-
"\": " + std::string(spec_textproto.status().message()));
107+
throw Nighthawk::NighthawkException(absl::StrCat("Failed to read spec textproto file \"",
108+
spec_filename_,
109+
"\": ", spec_textproto.status().message()));
109110
}
110111

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

0 commit comments

Comments
 (0)