Browse Source

Raise exception for non-Emscripten deployments in npm.py

Replace error logging with an exception to ensure that the code explicitly fails when attempting to deploy to NPM without Emscripten. This change enhances error handling by providing a clearer indication of incorrect deployment conditions.

Contribute to NP-637
NP-637_conan_v2_wasm
Jelle Spijker 1 year ago
parent
commit
1c071d1c59
  1. 5
      extensions/generators/npm.py

5
extensions/generators/npm.py

@ -1,7 +1,8 @@
import json
from conan import ConanFile
from conan.tools.files import copy, mkdir, save
from conan.errors import ConanException
from conan.tools.files import copy, save
from pathlib import Path
@ -12,7 +13,7 @@ class npm:
def generate(self):
if self._conanfile.settings.os != "Emscripten":
self._conanfile.output.error("Can only deploy to NPM when build for Emscripten")
return
raise ConanException("Can only deploy to NPM when build for Emscripten")
root_package = [dep for dep in self._conanfile.dependencies.direct_host.values()][0]

Loading…
Cancel
Save