Skip to content

Commit 3180df6

Browse files
authored
Merge pull request #297 from bernieyangmh/master
raise a execption when bucket is error
2 parents 0ff288c + 9e9effa commit 3180df6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

qiniu/zone.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ def get_bucket_hosts(self, ak, bucket):
9595
else:
9696
# 1 year
9797
hosts['ttl'] = int(time.time()) + 31536000
98-
99-
scheme_hosts = hosts[self.scheme]
98+
try:
99+
scheme_hosts = hosts[self.scheme]
100+
except KeyError:
101+
raise KeyError("Please check your BUCKET_NAME! The UpHosts is %s" % hosts)
100102
bucket_hosts = {
101103
'upHosts': scheme_hosts['up'],
102104
'ioHosts': scheme_hosts['io'],

0 commit comments

Comments
 (0)