Skip to content

Commit 33dfcaf

Browse files
committed
storage: fix return type of verify_read_iobuf
This was being implicitly converted to `std::error_code`.
1 parent 3779e33 commit 33dfcaf

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/v/storage/parser.cc

+13-10
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace storage {
3737
using stop_parser = batch_consumer::stop_parser;
3838
// make sure that `msg` parameter is a static string or it is not removed before
3939
// this function finishes
40-
static ss::future<result<iobuf>> verify_read_iobuf(
40+
static ss::future<result<iobuf, parser_errc>> verify_read_iobuf(
4141
ss::input_stream<char>& in,
4242
size_t expected,
4343
const char* msg,
@@ -204,15 +204,18 @@ ss::future<result<stop_parser>> continuous_batch_parser::consume_records() {
204204
auto sz = _header->size_bytes - model::packed_record_batch_header_size;
205205
return verify_read_iobuf(
206206
get_stream(), sz, "parser::consume_records", _recovery)
207-
.then([this](result<iobuf> record) -> ss::future<result<stop_parser>> {
208-
if (!record) {
209-
return ss::make_ready_future<result<stop_parser>>(record.error());
210-
}
211-
_consumer->consume_records(std::move(record.value()));
212-
return _consumer->consume_batch_end().then([](stop_parser sp) {
213-
return ss::make_ready_future<result<stop_parser>>(sp);
214-
});
215-
});
207+
.then(
208+
[this](result<iobuf, parser_errc> record)
209+
-> ss::future<result<stop_parser>> {
210+
if (!record) {
211+
return ss::make_ready_future<result<stop_parser>>(
212+
record.error());
213+
}
214+
_consumer->consume_records(std::move(record.value()));
215+
return _consumer->consume_batch_end().then([](stop_parser sp) {
216+
return ss::make_ready_future<result<stop_parser>>(sp);
217+
});
218+
});
216219
}
217220

218221
static constexpr std::array<parser_errc, 3> benign_error_codes{

0 commit comments

Comments
 (0)