From 1c071d1c591dfe64d9afbae24e99ea647ad88041 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Tue, 10 Dec 2024 11:08:12 +0100 Subject: [PATCH] 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 --- extensions/generators/npm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extensions/generators/npm.py b/extensions/generators/npm.py index 5c0d52e..24b9844 100644 --- a/extensions/generators/npm.py +++ b/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]