Skip to content

Commit

Permalink
C++ Client: End of Barrage stream should throw (rather than segfault)…
Browse files Browse the repository at this point in the history
…. Also reformat exception messages
  • Loading branch information
kosak committed Jun 26, 2024
1 parent f165357 commit f5a2add
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void UpdateProcessor::RunUntilCancelled(std::shared_ptr<UpdateProcessor> self) {
try {
self->RunForeverHelper();
} catch (...) {
// If the thread was been cancelled via explicit user action, then swallow all errors.
// If the thread has been cancelled via explicit user action, then swallow all errors.
if (!self->cancelled_) {
self->callback_->OnFailure(std::current_exception());
}
Expand All @@ -228,6 +228,11 @@ void UpdateProcessor::RunForeverHelper() {
while (true) {
auto chunk = fsr_->Next();
OkOrThrow(DEEPHAVEN_LOCATION_EXPR(chunk));
if (chunk->data == nullptr) {
// Stream ended. This is abnormal for Deephaven.
const char *message = "Unexpected end of stream";
throw std::runtime_error(DEEPHAVEN_LOCATION_STR(message));
}
const auto &cols = chunk->data->columns();
auto column_sources = MakeReservedVector<std::shared_ptr<ColumnSource>>(cols.size());
auto sizes = MakeReservedVector<size_t>(cols.size());
Expand Down
2 changes: 1 addition & 1 deletion cpp-client/deephaven/dhcore/src/utility/utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void TrueOrThrowHelper(const DebugInfo &debug_info) {

std::string FormatDebugString(const char *func, const char *file, size_t line,
const std::string &message) {
return fmt::format("{}@{}:{}: {}", func, file, line, message);
return fmt::format("{}: {}@{}:{}", message, func, file, line);
}

std::string GetWhat(std::exception_ptr eptr) {
Expand Down

0 comments on commit f5a2add

Please sign in to comment.