Skip to content

QCoro::waitFor does not rethrow exceptions #172

Closed
@cvuchener

Description

@cvuchener

Using a9c69b9

#include <QCoreApplication>
#include <QCoroTask>

int main(int argc, char *argv[])
{
	QCoreApplication app(argc, argv);

	auto task = []() -> QCoro::Task<> { 
		throw std::runtime_error("error");
		co_return;
	}();
	try {
		QCoro::waitFor(task);
		qInfo() << "Everything is fine";
	}
	catch (std::exception &e) {
		qInfo() << "Something went wrong:" << e.what();
	}
	return 0;
}

When the exception is thrown, QCoro::waitFor blocks forever instead of rethrowing the exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions