mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-04-19 22:38:52 +00:00
Correct propagating nvbench_main exceptions to Python
python examples/cpu_only.py --run-once -d 0 --output foo.md used to trip SystemError, returned a result with an exception set. It now returns a clean NVBenchmarkError exception.
This commit is contained in:
@@ -192,16 +192,14 @@ public:
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Caught exception while running benchmarks: ";
|
||||
ss << e.what();
|
||||
|
||||
const std::string &exc_message = ss.str();
|
||||
const std::string &exc_message = e.what();
|
||||
py::set_error(benchmark_exc, exc_message.c_str());
|
||||
throw py::error_already_set();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
py::set_error(benchmark_exc, "Caught unknown exception in nvbench_main");
|
||||
throw py::error_already_set();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user