Skip to content

Commit 72c2f86

Browse files
committed
just throw the exception
1 parent caddc57 commit 72c2f86

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/viam/sdk/rpc/dial.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,18 @@ std::shared_ptr<ViamChannel> ViamChannel::dial_initial(
123123
}
124124
opts.set_timeout(opts.initial_connection_attempt_timeout());
125125

126-
std::exception exception;
127-
while (attempts_remaining > 0) {
126+
while (attempts_remaining != 0) {
128127
try {
129128
auto connection = dial(uri, opts);
130129
opts.set_timeout(timeout);
131130
return connection;
132131
} catch (const std::exception& e) {
133132
attempts_remaining -= 1;
134-
exception = e;
133+
if (attempts_remaining == 0) {
134+
throw e;
135+
}
135136
}
136137
}
137-
138-
throw Exception(ErrorCondition::k_connection, exception.what());
139138
}
140139

141140
std::shared_ptr<ViamChannel> ViamChannel::dial(const char* uri,

0 commit comments

Comments
 (0)