MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / throwExceptionFromExpected

Function throwExceptionFromExpected

source/MRPython/MRPython.h:227–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225// overload `toString` functoion to throw exception from custom `Expected::error` type
226template<typename E>
227[[noreturn]] void throwExceptionFromExpected(const E& err)
228{
229 if constexpr (std::is_nothrow_convertible<E, std::string>::value)
230 throw std::runtime_error(err);
231 else
232 throw std::runtime_error(toString(err));
233}
234
235// Like `e.value()`, but throws using `throwExceptionFromExpected` (which is better, because it allows Python to see the proper error message), and also supports `T == void`.
236template <typename T>

Callers 2

expectedValueOrThrowFunction · 0.85
decorateExpectedFunction · 0.85

Calls 1

toStringFunction · 0.50

Tested by

no test coverage detected