diff --git a/docs/cookbook/create-user-programmatically.md b/docs/cookbook/create-user-programmatically.md index 74e4ae37..ababe9df 100644 --- a/docs/cookbook/create-user-programmatically.md +++ b/docs/cookbook/create-user-programmatically.md @@ -30,7 +30,7 @@ In the following sample, we import our dependencies and create a context manager We are now ready to write a function. The example below shows you a basic example but you can of course adapt it to your own needs. The key part here is once again to **take care of opening every context managers and pass them every required arguments**, as the dependency manager would do. -```py hl_lines="13-25" +```py hl_lines="13-27" --8<-- "docs/src/cookbook_create_user_programmatically.py" ``` diff --git a/docs/src/cookbook_create_user_programmatically.py b/docs/src/cookbook_create_user_programmatically.py index 01455d97..3255ede3 100644 --- a/docs/src/cookbook_create_user_programmatically.py +++ b/docs/src/cookbook_create_user_programmatically.py @@ -21,5 +21,7 @@ async def create_user(email: str, password: str, is_superuser: bool = False): ) ) print(f"User created {user}") + return user except UserAlreadyExists: print(f"User {email} already exists") + raise