- if (!clkCls) {
- if (_mClkClsExpectation != _ClkClsExpectation::NONE) {
- /*
- * `msg` is a stream beginning message because a message
- * iterator inactivity message always has a clock class.
- */
- const auto streamCls = msg.asStreamBeginning().stream().cls();
+ const auto actualClockCls = error.actualClockCls();
+
+ switch (error.type()) {
+ case Type::EXPECTING_NO_CLOCK_CLASS_GOT_ONE:
+ BT_CPPLOGE_APPEND_CAUSE_AND_THROW(bt2::Error,
+ "Expecting no clock class, but got one: "
+ "clock-class-addr={}, clock-class-name={}",
+ fmt::ptr(actualClockCls->libObjPtr()),
+ actualClockCls->name());
+
+ case Type::EXPECTING_ORIGIN_UNIX_GOT_NONE:
+ case Type::EXPECTING_ORIGIN_UUID_GOT_NONE:
+ case Type::EXPECTING_ORIGIN_NO_UUID_GOT_NONE:
+ {
+ const auto streamCls = *error.streamCls();