| 315 | |
| 316 | template <typename T, typename U, typename... CxtT> |
| 317 | inline 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. |
| 335 | template <typename T> |
no test coverage detected