From 8f727297e107826c8ddc75f19c0eba2ed0d1ecba Mon Sep 17 00:00:00 2001 From: Alex Weiss Date: Mon, 27 Mar 2017 10:35:09 -0400 Subject: [PATCH] Clarity of error messaging (#35) * Add more clarity to error messages when the destination doesn't exist * bump version --- baiji/copy.py | 10 +++++++++- baiji/package_version.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/baiji/copy.py b/baiji/copy.py index f1a5920..ce0d229 100644 --- a/baiji/copy.py +++ b/baiji/copy.py @@ -265,7 +265,15 @@ def execute(self): else: raise InvalidSchemeException("Copy for URI Scheme %s to %s is not implemented" % self.task) except KeyNotFound: - raise KeyNotFound("Error copying {} to {}: Source doesn't exist".format(self.src.uri, self.dst.uri)) + if self.dst.is_s3: + try: + _ = self.dst.bucket + except KeyNotFound: + raise KeyNotFound("Error copying {} to {}: Destination bucket doesn't exist".format(self.src.uri, self.dst.uri)) + if not self.src.exists(): + raise KeyNotFound("Error copying {} to {}: Source doesn't exist".format(self.src.uri, self.dst.uri)) + else: + raise KeyNotFound("Error copying {} to {}: Destination doesn't exist".format(self.src.uri, self.dst.uri)) except IOError as e: import errno if e.errno == errno.ENOENT: diff --git a/baiji/package_version.py b/baiji/package_version.py index c4866e2..369bca7 100644 --- a/baiji/package_version.py +++ b/baiji/package_version.py @@ -5,4 +5,4 @@ # # See https://www.python.org/dev/peps/pep-0420/#namespace-packages-today -__version__ = '2.6.0' +__version__ = '2.6.1'