From 7800a34d8475d3e5efd3dccd58e4275a2359eb0d Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 13 Dec 2013 18:11:17 -0500 Subject: [PATCH] Fix json_unhandled_exception handling of JsonableError. (imported from commit 16ed6c213cbda3b60a16a01af32c56d6802b7acc) --- zerver/lib/rest.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zerver/lib/rest.py b/zerver/lib/rest.py index da643074c2..b9c1e780f1 100644 --- a/zerver/lib/rest.py +++ b/zerver/lib/rest.py @@ -3,7 +3,7 @@ from __future__ import absolute_import from django.views.decorators.csrf import csrf_exempt, csrf_protect from zerver.decorator import authenticated_json_view, authenticated_rest_api_view, \ - process_as_post + process_as_post, JsonableError from zerver.lib.response import json_method_not_allowed, json_unauthorized, json_unhandled_exception from django.http import HttpResponseRedirect from django.conf import settings @@ -82,7 +82,9 @@ def rest_dispatch(request, globals_list, **kwargs): try: return target_function(request, **kwargs) - except: + except JsonableError: + raise + except Exception: logging.exception('Uncaught exception in rest_dispatch') return json_unhandled_exception()