Skip to content

Commit

Permalink
Added optional message to _generic_error() when raising exception (#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamarrow-zz authored and klueska committed Aug 16, 2017
1 parent 2cc696b commit 679b7f4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions dcos/subcommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,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 @@ -660,18 +660,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

0 comments on commit 679b7f4

Please sign in to comment.