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:14:06 +0100 |
commit | 07f76656d907a941f1bc18ad37599799b1ff271a (patch) | |
tree | 5ae551718b23fc267bbcfd1c3aaacdaedd36067b /scripts/devtool | |
parent | 5648a7909f4f185d0ead1299b0bdc484ff1bb700 (diff) | |
download | poky-07f76656d907a941f1bc18ad37599799b1ff271a.tar.gz |
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.
(From OE-Core rev: 2e4f1dcade7ccb581c7a390c32163ea3deeac6d5)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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 | |||
35 | scripts_path = os.path.dirname(os.path.realpath(__file__)) | 35 | scripts_path = os.path.dirname(os.path.realpath(__file__)) |
36 | lib_path = scripts_path + '/lib' | 36 | lib_path = scripts_path + '/lib' |
37 | sys.path = sys.path + [lib_path] | 37 | sys.path = sys.path + [lib_path] |
38 | from devtool import DevtoolError | ||
38 | import scriptutils | 39 | import scriptutils |
39 | logger = scriptutils.logger_create('devtool') | 40 | logger = scriptutils.logger_create('devtool') |
40 | 41 | ||
@@ -250,7 +251,12 @@ def main(): | |||
250 | if args.subparser_name != 'create-workspace': | 251 | if args.subparser_name != 'create-workspace': |
251 | read_workspace() | 252 | read_workspace() |
252 | 253 | ||
253 | ret = args.func(args, config, basepath, workspace) | 254 | try: |
255 | ret = args.func(args, config, basepath, workspace) | ||
256 | except DevtoolError as err: | ||
257 | if str(err): | ||
258 | logger.error(str(err)) | ||
259 | ret = 1 | ||
254 | 260 | ||
255 | return ret | 261 | return ret |
256 | 262 | ||