зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1473498
- [mozbuild.mozconfig] Improve error message in MozconfigLoadException r=glandium
Without the output, this exception wasn't being very helpful. Differential Revision: https://phabricator.services.mozilla.com/D42015 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e533de9b0e
Коммит
9ec9b5b7ab
|
@ -880,16 +880,7 @@ class MachCommandBase(MozbuildObject):
|
|||
sys.exit(1)
|
||||
|
||||
except MozconfigLoadException as e:
|
||||
print('Error loading mozconfig: ' + e.path)
|
||||
print('')
|
||||
print(e.message)
|
||||
if e.output:
|
||||
print('')
|
||||
print('mozconfig output:')
|
||||
print('')
|
||||
for line in e.output:
|
||||
print(line)
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
MozbuildObject.__init__(self, topsrcdir, context.settings,
|
||||
|
@ -908,16 +899,7 @@ class MachCommandBase(MozbuildObject):
|
|||
sys.exit(1)
|
||||
|
||||
except MozconfigLoadException as e:
|
||||
print('Error loading mozconfig: ' + e.path)
|
||||
print('')
|
||||
print(e.message)
|
||||
if e.output:
|
||||
print('')
|
||||
print('mozconfig output:')
|
||||
print('')
|
||||
for line in e.output:
|
||||
print(line)
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
# Always keep a log of the last command, but don't do that for mach
|
||||
|
|
|
@ -10,6 +10,7 @@ import re
|
|||
import sys
|
||||
import subprocess
|
||||
import traceback
|
||||
from textwrap import dedent
|
||||
|
||||
from mozpack import path as mozpath
|
||||
from mozbuild.util import system_encoding
|
||||
|
@ -54,6 +55,20 @@ class MozconfigLoadException(Exception):
|
|||
def __init__(self, path, message, output=None):
|
||||
self.path = path
|
||||
self.output = output
|
||||
|
||||
message = dedent("""
|
||||
Error loading mozconfig: {path}
|
||||
|
||||
{message}
|
||||
""").format(path=self.path, message=message).lstrip()
|
||||
|
||||
if self.output:
|
||||
message += dedent("""
|
||||
mozconfig output:
|
||||
|
||||
{output}
|
||||
""").format(output="\n".join(self.output))
|
||||
|
||||
Exception.__init__(self, message)
|
||||
|
||||
|
||||
|
|
|
@ -455,8 +455,8 @@ class TestMozconfigLoader(unittest.TestCase):
|
|||
with self.assertRaises(MozconfigLoadException) as e:
|
||||
self.get_loader().read_mozconfig(mozconfig.name)
|
||||
|
||||
self.assertTrue(e.exception.message.startswith(
|
||||
'Evaluation of your mozconfig exited with an error'))
|
||||
self.assertIn('Evaluation of your mozconfig exited with an error',
|
||||
e.exception.message)
|
||||
self.assertEquals(e.exception.path,
|
||||
mozconfig.name.replace(os.sep, '/'))
|
||||
self.assertEquals(e.exception.output, ['hello world'])
|
||||
|
|
Загрузка…
Ссылка в новой задаче