MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / handleCAPIError

Function handleCAPIError

lib/api/wasmedge.cpp:303–314  ·  view source on GitHub ↗

Helper to log and convert exceptions at the C API boundary.

Source from the content-addressed store, hash-verified

301}
302// Helper to log and convert exceptions at the C API boundary.
303inline WasmEdge_Result handleCAPIError() noexcept {
304 try {
305 throw;
306 } catch (const std::bad_alloc &) {
307 spdlog::error("C API failed: memory allocation failure"sv);
308 } catch (const std::exception &E) {
309 spdlog::error("C API failed: {}"sv, E.what());
310 } catch (...) {
311 spdlog::error("C API failed: unknown exception"sv);
312 }
313 return genWasmEdge_Result(ErrCode::Value::RuntimeError);
314}
315
316template <typename T, typename U, typename... CxtT>
317inline WasmEdge_Result wrap(T &&Proc, U &&Then, CxtT *...Cxts) noexcept {

Calls 3

genWasmEdge_ResultFunction · 0.85
errorFunction · 0.50
whatMethod · 0.45

Tested by

no test coverage detected