aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/serialise.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-08-21 15:22:04 +0200
committerEelco Dolstra <edolstra@gmail.com>2018-08-21 15:22:04 +0200
commitebe3d2d3704aca001ff818295af014581dcf348f (patch)
tree764c095d28a734dd4ba89c94de086214460bbc93 /src/libutil/serialise.hh
parent6317c65937ad7d9c5a954c4dfc48de259e55f4f3 (diff)
Improve 'coroutine has finished' error message
Diffstat (limited to 'src/libutil/serialise.hh')
-rw-r--r--src/libutil/serialise.hh6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh
index 14b62fdb6..4b6ad5da5 100644
--- a/src/libutil/serialise.hh
+++ b/src/libutil/serialise.hh
@@ -214,7 +214,11 @@ struct LambdaSource : Source
/* Convert a function that feeds data into a Sink into a Source. The
Source executes the function as a coroutine. */
-std::unique_ptr<Source> sinkToSource(std::function<void(Sink &)> fun);
+std::unique_ptr<Source> sinkToSource(
+ std::function<void(Sink &)> fun,
+ std::function<void()> eof = []() {
+ throw EndOfFile("coroutine has finished");
+ });
void writePadding(size_t len, Sink & sink);