diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2015-05-27 17:59:09 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-18 09:12:01 +0100 |
commit | 2e4f1dcade7ccb581c7a390c32163ea3deeac6d5 (patch) | |
tree | 6e17bc8490ff99cc3954e53e2fe8c3ae16fae708 /scripts/devtool | |
parent | 30fd41bd06a61e9df47263d49119fb8e193cdf68 (diff) | |
download | openembedded-core-2e4f1dcade7ccb581c7a390c32163ea3deeac6d5.tar.gz openembedded-core-2e4f1dcade7ccb581c7a390c32163ea3deeac6d5.tar.bz2 openembedded-core-2e4f1dcade7ccb581c7a390c32163ea3deeac6d5.zip |
devtool: use DevtoolError for error handling
Use DevtoolError exception more widely for handling error cases. This
exception is now caught in the main script and raising it can be used to
exit with an error. This hopefully simplifies error handling. The
change also makes exit codes more consistent, always returning '1' when
an error occurs.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'scripts/devtool')
-rwxr-xr-x | scripts/devtool | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/devtool b/scripts/devtool index fd4af9838a..fa799f6a06 100755 --- a/scripts/devtool +++ b/scripts/devtool @@ -35,6 +35,7 @@ context = None scripts_path = os.path.dirname(os.path.realpath(__file__)) lib_path = scripts_path + '/lib' sys.path = sys.path + [lib_path] +from devtool import DevtoolError import scriptutils logger = scriptutils.logger_create('devtool') @@ -250,7 +251,12 @@ def main(): if args.subparser_name != 'create-workspace': read_workspace() - ret = args.func(args, config, basepath, workspace) + try: + ret = args.func(args, config, basepath, workspace) + except DevtoolError as err: + if str(err): + logger.error(str(err)) + ret = 1 return ret |