Skip to content

xcpp::clear_output does not clear exception messages #433

@AntoinePrv

Description

@AntoinePrv

I am unsure how to reproduce this without xwidgets.

Minimal example (Can be tried here).

  • Change value to 0, 1, 2, 3, everything going as planned;
  • Set value to 33, an exception message is shown;
  • Change value to 0, the exception message is not cleared.
  • Change value to 1, the message for 0 is cleared, the exception message is not cleared.
#include <iostream>
#include <stdexcept>
#include <xwidgets/xall.hpp>
#include <xcpp/xdisplay.hpp>


auto num = xw::number<std::uint32_t>();
auto out = xw::output();

XOBSERVE(num, value, [&](const auto& s) {
    auto g = out.guard();
    xcpp::clear_output();
    if(s.value() == 33){
        throw std::runtime_error("Exception");
    }

    std::cout << "Value: " << s.value() << std::endl;
});

xcpp::display(num);
xcpp::display(out);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs triageUsed in auto labelling of new issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions