scripts: zephyr_module: handle expected west errors
Errors can occur if the user's workspace is not set up properly. Output a better error message instead of dumping stack in these cases. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
2be2fa8bd6
commit
ce2a7d9a1a
1 changed files with 6 additions and 1 deletions
|
@ -521,7 +521,9 @@ def west_projects(manifest = None):
|
||||||
# (and thus maybe not installed)
|
# (and thus maybe not installed)
|
||||||
# if user is providing a specific modules list.
|
# if user is providing a specific modules list.
|
||||||
try:
|
try:
|
||||||
from west.manifest import Manifest
|
from west.manifest import Manifest, \
|
||||||
|
ManifestImportFailed, MalformedManifest, ManifestVersionError
|
||||||
|
from west.configuration import MalformedConfig
|
||||||
from west.util import WestNotFound
|
from west.util import WestNotFound
|
||||||
from west.version import __version__ as WestVersion
|
from west.version import __version__ as WestVersion
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -539,6 +541,9 @@ def west_projects(manifest = None):
|
||||||
projects = manifest.get_projects([])
|
projects = manifest.get_projects([])
|
||||||
manifest_path = manifest.path
|
manifest_path = manifest.path
|
||||||
return {'manifest_path': manifest_path, 'projects': projects}
|
return {'manifest_path': manifest_path, 'projects': projects}
|
||||||
|
except (ManifestImportFailed, MalformedManifest,
|
||||||
|
ManifestVersionError, MalformedConfig) as e:
|
||||||
|
sys.exit(f'ERROR: {e}')
|
||||||
except WestNotFound:
|
except WestNotFound:
|
||||||
# Only accept WestNotFound, meaning we are not in a west
|
# Only accept WestNotFound, meaning we are not in a west
|
||||||
# workspace. Such setup is allowed, as west may be installed
|
# workspace. Such setup is allowed, as west may be installed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue