Skip to content

Commit

Permalink
feat(environment_dispatch): Raise error for async function when not a…
Browse files Browse the repository at this point in the history
…vailable
  • Loading branch information
thewtex committed Apr 22, 2023
1 parent e3b1df4 commit d52a836
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/core/python/itkwasm/itkwasm/environment_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ def environment_dispatch(interface_package: str, func_name: str) -> Callable:
return factory_func

if sys.platform != "emscripten":
if func_name.endswith('_async'):
raise ValueError('async function are only implemented for emscripten')
package = f"{interface_package}_wasi"
else:
if not func_name.endswith('_async'):
raise ValueError('emscripten only implements the _async version of this function')
package = f"{interface_package}_emscripten"
mod = importlib.import_module(package)
func = getattr(mod, func_name)
Expand Down

0 comments on commit d52a836

Please sign in to comment.