Эх сурвалжийг харах

HUE-6695 [aws] Provide user-friendly message when accessing forbidden paths

https://www.dropbox.com/s/ovht7gj2aosvsci/Screenshot%202017-06-09%2012.13.23.png?dl=0
Jenny Kim 8 жил өмнө
parent
commit
aab3c6d

+ 3 - 1
desktop/libs/aws/src/aws/s3/s3fs.py

@@ -142,9 +142,11 @@ class S3FileSystem(object):
     try:
       return bucket.get_key(key_name, validate=validate)
     except S3ResponseError, e:
-      if e.status == 301:
+      if e.status in (301, 400):
         raise S3FileSystemException(_('Failed to access path: "%s" '
           'Check that you have access to read this bucket and that the region is correct: %s') % (path, e.message or e.reason))
+      elif e.status == 403:
+        raise S3FileSystemException(_('User is not authorized to access path at "%s".' % path))
       else:
         raise S3FileSystemException(e.message or e.reason)