Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subcommand: add exception message to _generic_error #976

Merged
merged 1 commit into from
Aug 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions dcos/subcommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def _install_with_binary(
raise
except Exception as e:
logger.exception(e)
raise _generic_error(package_name)
raise _generic_error(package_name, e.message)

return None

Expand Down Expand Up @@ -594,18 +594,20 @@ def _execute_command(command):
return stdout, stderr, process.returncode


def _generic_error(package_name):
def _generic_error(package_name, err=None):
"""
:param package: package name
:type: str
:param err: error message
:type err: str
:returns: generic error when installing package
:rtype: DCOSException
"""

return DCOSException(
('Error installing {!r} package.\n'
'Run with `dcos --log-level=ERROR` to see the full output.').format(
package_name))
msg = 'Error installing {!r} package.'.format(package_name)
if err:
msg += ' {}'.format(err)
return DCOSException(msg)


class InstalledSubcommand(object):
Expand Down