async: handle exceptions and stops
Add support in `context` and `scope` to handle exceptions and stop
conditions:
* When an unhandled_stop occurs, turn it into an UnhandledStop
exception.
* When a `scope`-spawned task throws an exception, save it and cause
`set_error` on the `scope::empty()`'s Receiver.
* When anything in the `context` completes with `set_error` propagate
that out to the caller of `context::run`.
* If multiple exceptions occur within a `scope`, terminate.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I25285f7ece5c0675864489bbe1345fa8e7afa70c
diff --git a/src/exception.cpp b/src/exception.cpp
index 1407147..05647aa 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -178,6 +178,26 @@
return EINVAL;
}
+const char* UnhandledStop::name() const noexcept
+{
+ return errName;
+}
+
+const char* UnhandledStop::description() const noexcept
+{
+ return errDesc;
+}
+
+const char* UnhandledStop::what() const noexcept
+{
+ return errWhat;
+}
+
+int UnhandledStop::get_errno() const noexcept
+{
+ return ECANCELED;
+}
+
} // namespace exception
} // namespace sdbusplus