Skip to content

Commit 54269d2

Browse files
committed
Slightly improve a handful of error message texts.
1 parent 0cde3be commit 54269d2

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

lib-protocol/source/channel.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ task<void> Channel::Send(const Buffer &data) {
170170
writ = std::move(error); });
171171
}, *(sctp->*Loot<SctpDataChannel$network_thread_>::pointer));
172172

173-
orc_assert((co_await *writ).ok());
173+
const auto error(co_await *writ);
174+
orc_assert_(error.ok(), error.message());
174175
}
175176

176177
task<std::string> Description(const S<Base> &base, std::vector<std::string> ice) {

lib-protocol/source/layer.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ auto Layer(Base &base, const Locator &locator, const std::function<bool (const s
7373

7474
co_return co_await std::move(code)(std::make_unique<Type_<boost::beast::ssl_stream<Adapter>>>(std::move(stream)));
7575
} else orc_assert(false);
76-
}, "connected to " << endpoint); } catch (...) {
76+
}, "using endpoint " << endpoint); } catch (...) {
7777
// XXX: maybe I should merge the exceptions? that would be cool
7878
if (error == nullptr)
7979
error = std::current_exception();

lib-protocol/source/valve.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Valve {
4242

4343
protected:
4444
void Stop() noexcept {
45-
orc_insist(!shut_);
45+
orc_insist_(!shut_, "double stop: " << type_);
4646
shut_();
4747
}
4848

srv-daemon/source/croupier.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Croupier {
6060

6161
const S<Lottery1> &Find1(const Address &contract, const uint256_t &chain) {
6262
const auto lottery(lotteries1_.find(chain));
63-
orc_assert(lottery != lotteries1_.end());
63+
orc_assert_(lottery != lotteries1_.end(), "unsupported lottery chain " << chain);
6464
orc_assert(lottery->second->Contract() == contract);
6565
return lottery->second;
6666
}

srv-daemon/source/server.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ void Server::Submit0(Pipe<Buffer> *pipe, const Socket &source, const Bytes32 &id
174174

175175
const auto until(start + range);
176176
const auto now(Timestamp());
177-
orc_assert(until > now);
177+
orc_assert_(until > now, "expired ticket (by " << (now - until) << " seconds)");
178178

179179
const auto &lottery(croupier_->Find0(contract, chain, recipient));
180180
const uint64_t gas(receipt.size() == 0 ? 84000 /*83267*/ : 103000);
@@ -275,8 +275,9 @@ void Server::Submit1(Pipe<Buffer> *pipe, const Socket &source, const Bytes32 &id
275275

276276
orc_assert_(recipient == croupier_->Recipient(), recipient << " != " << croupier_->Recipient() << " in " << data);
277277

278+
const auto until(issued + expire);
278279
const auto now(Timestamp());
279-
orc_assert(issued + expire > now);
280+
orc_assert_(until > now, "expired ticket (by " << (now - until) << " seconds)");
280281

281282
const auto &lottery(croupier_->Find1(contract, chain));
282283
const uint64_t gas(60000);

0 commit comments

Comments
 (0)