* Changed 404 errors to 400 errors
* Removed duplicate traceback log message * Now provide string, not Exception, as second tuple item to raise
This commit is contained in:
@@ -455,7 +455,7 @@ def preview_dispatch(request, preview_id, location, dispatch=None):
|
||||
|
||||
except ProcessingError:
|
||||
log.exception("Module raised an error while processing AJAX request")
|
||||
raise Http404
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
except:
|
||||
log.exception("error processing ajax call")
|
||||
|
||||
@@ -1237,11 +1237,10 @@ def sympy_check2():
|
||||
# Log the error if we are debugging
|
||||
msg = 'Error occurred while evaluating CustomResponse'
|
||||
log.debug(msg, exc_info=True)
|
||||
log.debug(traceback.format_exc())
|
||||
|
||||
# Notify student with a student input error
|
||||
_, _, traceback_obj = sys.exc_info()
|
||||
raise ResponseError, ResponseError(err.message), traceback_obj
|
||||
raise ResponseError, err.message, traceback_obj
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -461,7 +461,7 @@ class CapaModule(CapaFields, XModule):
|
||||
|
||||
except Exception as err:
|
||||
_, _, traceback_obj = sys.exc_info()
|
||||
raise ProcessingError, ProcessingError(err.message), traceback_obj
|
||||
raise ProcessingError, err.message, traceback_obj
|
||||
|
||||
after = self.get_progress()
|
||||
d.update({
|
||||
|
||||
@@ -10,7 +10,7 @@ from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import Http404
|
||||
from django.http import HttpResponse
|
||||
from django.http import HttpResponse, HttpResponseBadRequest
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
from requests.auth import HTTPBasicAuth
|
||||
@@ -449,10 +449,10 @@ def modx_dispatch(request, dispatch, location, course_id):
|
||||
log.exception("Module indicating to user that request doesn't exist")
|
||||
raise Http404
|
||||
|
||||
# For XModule-specific errors, we respond with 404
|
||||
# For XModule-specific errors, we respond with 400
|
||||
except ProcessingError:
|
||||
log.exception("Module encountered an error while prcessing AJAX call")
|
||||
raise Http404
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
# If any other error occurred, re-raise it to trigger a 500 response
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user