Skip to content

Commit

Permalink
Make 'wrong unpacker' a UsageError
Browse files Browse the repository at this point in the history
This hides the traceback.
  • Loading branch information
remram44 committed Mar 5, 2015
1 parent c2c3a71 commit b978e6a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions reprounzip-docker/reprounzip/unpackers/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
from reprounzip.common import Package, load_config, record_usage
from reprounzip import signals
from reprounzip.unpackers.common import COMPAT_OK, COMPAT_MAYBE, \
CantFindInstaller, composite_action, target_must_exist, make_unique_name, \
shell_escape, select_installer, busybox_url, join_root, \
UsageError, CantFindInstaller, composite_action, target_must_exist, \
make_unique_name, shell_escape, select_installer, busybox_url, join_root, \
FileUploader, FileDownloader, get_runs, interruptible_call
from reprounzip.unpackers.common.x11 import X11Handler, LocalForwarder
from reprounzip.utils import unicode_, iteritems, download_file
Expand Down Expand Up @@ -93,7 +93,7 @@ def read_dict(filename):
with filename.open('rb') as fp:
dct = pickle.load(fp)
if dct['unpacker'] != 'docker':
raise ValueError("Wrong unpacker used: %s != docker" % dct['unpacker'])
raise UsageError("Wrong unpacker used: %s != docker" % dct['unpacker'])
return dct


Expand Down
6 changes: 3 additions & 3 deletions reprounzip-vagrant/reprounzip/unpackers/vagrant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
from reprounzip.common import load_config, record_usage
from reprounzip import signals
from reprounzip.unpackers.common import COMPAT_OK, COMPAT_MAYBE, \
CantFindInstaller, composite_action, target_must_exist, make_unique_name, \
shell_escape, select_installer, busybox_url, join_root, \
UsageError, CantFindInstaller, composite_action, target_must_exist, \
make_unique_name, shell_escape, select_installer, busybox_url, join_root, \
FileUploader, FileDownloader, get_runs
from reprounzip.unpackers.common.x11 import X11Handler
from reprounzip.unpackers.vagrant.run_command import IgnoreMissingKey, \
Expand Down Expand Up @@ -100,7 +100,7 @@ def read_dict(filename):
with filename.open('rb') as fp:
dct = pickle.load(fp)
if dct['unpacker'] != 'vagrant':
raise ValueError("Wrong unpacker used: %s != vagrant" %
raise UsageError("Wrong unpacker used: %s != vagrant" %
dct['unpacker'])
return dct

Expand Down
6 changes: 3 additions & 3 deletions reprounzip/reprounzip/unpackers/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
from reprounzip.common import load_config as load_config_file, record_usage
from reprounzip import signals
from reprounzip.unpackers.common import THIS_DISTRIBUTION, PKG_NOT_INSTALLED, \
COMPAT_OK, COMPAT_NO, CantFindInstaller, target_must_exist, shell_escape, \
load_config, select_installer, busybox_url, join_root, \
COMPAT_OK, COMPAT_NO, UsageError, CantFindInstaller, target_must_exist, \
shell_escape, load_config, select_installer, busybox_url, join_root, \
FileUploader, FileDownloader, get_runs, interruptible_call
from reprounzip.unpackers.common.x11 import X11Handler, LocalForwarder
from reprounzip.utils import unicode_, irange, iteritems, itervalues, \
Expand Down Expand Up @@ -98,7 +98,7 @@ def read_dict(filename, type_):
with filename.open('rb') as fp:
dct = pickle.load(fp)
if type_ is not None and dct['unpacker'] != type_:
raise ValueError("Wrong unpacker used: %s != %s" % (dct['unpacker'],
raise UsageError("Wrong unpacker used: %s != %s" % (dct['unpacker'],
type_))
return dct

Expand Down

0 comments on commit b978e6a

Please sign in to comment.