diff options
author | Jukka Laurila <jlaurila@google.com> | 2018-03-10 13:18:15 +0100 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-03-10 18:04:52 +0200 |
commit | 52c50da6c7a921e1625fff26c7844af7d941afd9 (patch) | |
tree | e93c2d10aeed04b9a928f1387a469d98ef1524d8 /mesonbuild/mesonmain.py | |
parent | f6fd03485e6ab95aae766649f621a9b4260ea674 (diff) | |
download | meson-52c50da6c7a921e1625fff26c7844af7d941afd9.zip meson-52c50da6c7a921e1625fff26c7844af7d941afd9.tar.gz meson-52c50da6c7a921e1625fff26c7844af7d941afd9.tar.bz2 |
Refactor: Add log.error and log.exception to reduce code duplication.
Diffstat (limited to 'mesonbuild/mesonmain.py')
-rw-r--r-- | mesonbuild/mesonmain.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index 69b4e31..9c4498c 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -304,7 +304,7 @@ def run(original_args, mainfile=None): try: return mconf.run(remaining_args) except MesonException as e: - mlog.log(mlog.red('\nError configuring project:'), e) + mlog.exception(e) sys.exit(1) elif cmd_name == 'wrap': return wraptool.run(remaining_args) @@ -324,8 +324,8 @@ def run(original_args, mainfile=None): try: sys.exit(run_script_command(args[1:])) except MesonException as e: - mlog.log(mlog.red('\nError in {} helper script:'.format(script))) - mlog.log(e) + mlog.error('\nError in {} helper script:'.format(script)) + mlog.exception(e) sys.exit(1) args = args[2:] handshake = True @@ -368,13 +368,7 @@ def run(original_args, mainfile=None): app.generate() except Exception as e: if isinstance(e, MesonException): - mlog.log() - if hasattr(e, 'file') and hasattr(e, 'lineno') and hasattr(e, 'colno'): - mlog.log('%s:%d:%d:' % (e.file, e.lineno, e.colno), mlog.red('ERROR: '), end='') - else: - mlog.log(mlog.red('ERROR: '), end='') - # Error message - mlog.log(e) + mlog.exception(e) # Path to log file mlog.shutdown() logfile = os.path.join(app.build_dir, environment.Environment.log_dir, mlog.log_fname) |