From 98d30d8715a60fcfcb015b13645675c15347b7da Mon Sep 17 00:00:00 2001 From: nicoo Date: Sun, 10 Sep 2023 10:32:05 +0000 Subject: [PATCH] noto-fonts-monochrome-emoji: Handle 403 errors in update script --- pkgs/data/fonts/noto-fonts/noto-emoji.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/data/fonts/noto-fonts/noto-emoji.py b/pkgs/data/fonts/noto-fonts/noto-emoji.py index 31e27d922220..9f1eadd95bca 100755 --- a/pkgs/data/fonts/noto-fonts/noto-emoji.py +++ b/pkgs/data/fonts/noto-fonts/noto-emoji.py @@ -135,6 +135,15 @@ if __name__ == "__main__": case KeyError if exn.args[0] == environVar: print(f"No '{environVar}' in the environment, " "skipping metadata update") + + case HTTPError if exn.getcode() == 403: + print("Got HTTP 403 (Forbidden)") + if apiToken != '': + print("Your Google API key appears to be valid " + "but does not grant access to the fonts API.") + print("Aborting!") + raise SystemExit(1) + case HTTPError if exn.getcode() == 400: # Printing the supposed token should be fine, as this is # what the API returns on invalid tokens.