File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,16 @@ def load_tzdata(key):
11
11
try :
12
12
return importlib .resources .open_binary (package_name , resource_name )
13
13
except (ImportError , FileNotFoundError , UnicodeEncodeError ) as e :
14
+ # There are three types of exception that can be raised that all amount
15
+ # to "we cannot find this key":
16
+ #
17
+ # ImportError: If package_name doesn't exist (e.g. if tzdata is not
18
+ # installed, or if there's an error in the folder name like
19
+ # Amrica/New_York)
20
+ # FileNotFoundError: If resource_name doesn't exist in the package
21
+ # (e.g. Europe/Krasnoy)
22
+ # UnicodeEncodeError: If package_name or resource_name are not UTF-8,
23
+ # such as keys containing a surrogate character.
14
24
raise ZoneInfoNotFoundError (f"No time zone found with key { key } " ) from e
15
25
16
26
You can’t perform that action at this time.
0 commit comments