From c646fc6a0258fd476326806ba6d86510f957f7c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=E1=BA=A3o=20Nguy=E1=BB=85n?= <100182329+nguyenduybao1@users.noreply.github.com> Date: Thu, 5 Mar 2026 16:50:48 +0700 Subject: [PATCH] fix(curriculum): update custom exception example in Python review (#66102) --- .../review-error-handling/67f39bcb48373420f4f12d62.md | 6 +++--- .../blocks/review-python/67f39e391c9b373069def02c.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/curriculum/challenges/english/blocks/review-error-handling/67f39bcb48373420f4f12d62.md b/curriculum/challenges/english/blocks/review-error-handling/67f39bcb48373420f4f12d62.md index 3d8bc87b8d9..837a71e164c 100644 --- a/curriculum/challenges/english/blocks/review-error-handling/67f39bcb48373420f4f12d62.md +++ b/curriculum/challenges/english/blocks/review-error-handling/67f39bcb48373420f4f12d62.md @@ -99,20 +99,20 @@ dashedName: review-error-handling return f"Welcome, {username}!" ``` - Here's a how you can use the `login` function from the `InvalidCredentialsError` exception: + Here's a how you can use the `login` function with the `InvalidCredentialsError` exception: ```py # failed login attempt try: message = login("user", "wrongpassword") - print(message) except InvalidCredentialsError as e: print(f"Login failed: {e}") + else: + print(message) # successful login attempt try: message = login("admin", "password123") - print(message) except InvalidCredentialsError as e: # This block is not executed because the login was successful print(f"Login failed: {e}") diff --git a/curriculum/challenges/english/blocks/review-python/67f39e391c9b373069def02c.md b/curriculum/challenges/english/blocks/review-python/67f39e391c9b373069def02c.md index dbb281880c3..c7e5d722b41 100644 --- a/curriculum/challenges/english/blocks/review-python/67f39e391c9b373069def02c.md +++ b/curriculum/challenges/english/blocks/review-python/67f39e391c9b373069def02c.md @@ -2041,20 +2041,20 @@ if __name__ == '__main__': return f"Welcome, {username}!" ``` - Here's a how you can use the `login` function from the `InvalidCredentialsError` exception: + Here's a how you can use the `login` function with the `InvalidCredentialsError` exception: ```py # failed login attempt try: message = login("user", "wrongpassword") - print(message) except InvalidCredentialsError as e: print(f"Login failed: {e}") + else: + print(message) # successful login attempt try: message = login("admin", "password123") - print(message) except InvalidCredentialsError as e: # This block is not executed because the login was successful print(f"Login failed: {e}")