From 08e1759ad0d6a0c7a5cb0f1e3690a08842f84b71 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sun, 5 Mar 2017 16:13:55 -0800 Subject: [PATCH] bots: Replace bare excepts with targeted exceptions. --- zerver/views/users.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zerver/views/users.py b/zerver/views/users.py index 2fcf63072e..2b9ec129ed 100644 --- a/zerver/views/users.py +++ b/zerver/views/users.py @@ -160,7 +160,7 @@ def patch_bot_backend(request, user_profile, email, # type: (HttpRequest, UserProfile, Text, Optional[Text], Optional[Text], Optional[Text], Optional[Text], Optional[bool]) -> HttpResponse try: bot = get_user_profile_by_email(email) - except: + except UserProfile.DoesNotExist: return json_error(_('No such user')) if not user_profile.can_admin_user(bot): @@ -218,7 +218,7 @@ def regenerate_bot_api_key(request, user_profile, email): # type: (HttpRequest, UserProfile, Text) -> HttpResponse try: bot = get_user_profile_by_email(email) - except: + except UserProfile.DoesNotExist: return json_error(_('No such user')) if not user_profile.can_admin_user(bot):