mirror of https://github.com/docker/docs.git
Friendlier build error
Hide the backtrace and show a comprehensible message. Closes #160.
This commit is contained in:
parent
a96ab41739
commit
168b1909ae
|
@ -9,7 +9,7 @@ from inspect import getdoc
|
||||||
|
|
||||||
from .. import __version__
|
from .. import __version__
|
||||||
from ..project import NoSuchService, ConfigurationError
|
from ..project import NoSuchService, ConfigurationError
|
||||||
from ..service import CannotBeScaledError
|
from ..service import BuildError, CannotBeScaledError
|
||||||
from .command import Command
|
from .command import Command
|
||||||
from .formatter import Formatter
|
from .formatter import Formatter
|
||||||
from .log_printer import LogPrinter
|
from .log_printer import LogPrinter
|
||||||
|
@ -51,6 +51,9 @@ def main():
|
||||||
except APIError as e:
|
except APIError as e:
|
||||||
log.error(e.explanation)
|
log.error(e.explanation)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
except BuildError as e:
|
||||||
|
log.error("Service '%s' failed to build." % e.service.name)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
# stolen from docopt master
|
# stolen from docopt master
|
||||||
|
|
|
@ -22,7 +22,8 @@ DOCKER_CONFIG_HINTS = {
|
||||||
|
|
||||||
|
|
||||||
class BuildError(Exception):
|
class BuildError(Exception):
|
||||||
pass
|
def __init__(self, service):
|
||||||
|
self.service = service
|
||||||
|
|
||||||
|
|
||||||
class CannotBeScaledError(Exception):
|
class CannotBeScaledError(Exception):
|
||||||
|
@ -298,7 +299,7 @@ class Service(object):
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
|
|
||||||
if image_id is None:
|
if image_id is None:
|
||||||
raise BuildError()
|
raise BuildError(self)
|
||||||
|
|
||||||
return image_id
|
return image_id
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue