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

Function wrap

lib/api/wasmedge.cpp:317–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315
316template <typename T, typename U, typename... CxtT>
317inline WasmEdge_Result wrap(T &&Proc, U &&Then, CxtT *...Cxts) noexcept {
318 if (isContext(Cxts...)) {
319 try {
320 if (auto Res = Proc()) {
321 Then(Res);
322 return genWasmEdge_Result(ErrCode::Value::Success);
323 } else {
324 return genWasmEdge_Result(Res.error());
325 }
326 } catch (...) {
327 return handleCAPIError();
328 }
329 } else {
330 return genWasmEdge_Result(ErrCode::Value::WrongVMWorkflow);
331 }
332}
333
334// Helper function for retrieving exported maps.
335template <typename T>

Calls 3

isContextFunction · 0.85
genWasmEdge_ResultFunction · 0.85
handleCAPIErrorFunction · 0.85

Tested by

no test coverage detected