aboutsummaryrefslogtreecommitdiff
path: root/codegen/lib
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-25 20:09:48 -0500
committermat <github@matdoes.dev>2022-05-25 20:09:48 -0500
commitc851204dd0c4b9eee8acc12c4de56b90e1bf041b (patch)
treec1cb22d0e510593a678ce59ebd177f66c1ffa851 /codegen/lib
parentd69f4445f31b0093d233fc052735c772bdab16b1 (diff)
downloadazalea-drasl-c851204dd0c4b9eee8acc12c4de56b90e1bf041b.tar.xz
Fix detecting changed packet ids
Diffstat (limited to 'codegen/lib')
-rw-r--r--codegen/lib/download.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/codegen/lib/download.py b/codegen/lib/download.py
index 284591ab..5030f8f3 100644
--- a/codegen/lib/download.py
+++ b/codegen/lib/download.py
@@ -41,8 +41,12 @@ def get_version_data(version_id: str):
print(
f'\033[92mGetting data for \033[1m{version_id}..\033[m')
- package_url = next(
- filter(lambda v: v['id'] == version_id, version_manifest_data['versions']))['url']
+ try:
+ package_url = next(
+ filter(lambda v: v['id'] == version_id, version_manifest_data['versions']))['url']
+ except StopIteration:
+ raise ValueError(
+ f'No version with id {version_id} found. Maybe delete downloads/version_manifest.json and try again?')
package_data = requests.get(package_url).json()
with open(f'downloads/{version_id}.json', 'w') as f:
json.dump(package_data, f)