Commit 6a10ffc7 by Vik Paruchuri

Fix up error messages to staff and students

parent 00bc8dee
......@@ -45,7 +45,8 @@ def staff_grading_notifications(course, user):
except:
#Non catastrophic error, so no real action
notifications = {}
log.info("Problem with getting notifications from staff grading service.")
#This is a dev_facing_error
log.info("Problem with getting notifications from staff grading service for course {0} user {1}.".format(course_id, student_id))
if pending_grading:
img_path = "/static/images/grading_notification.png"
......@@ -78,7 +79,8 @@ def peer_grading_notifications(course, user):
except:
#Non catastrophic error, so no real action
notifications = {}
log.info("Problem with getting notifications from peer grading service.")
#This is a dev_facing_error
log.info("Problem with getting notifications from peer grading service for course {0} user {1}.".format(course_id, student_id))
if pending_grading:
img_path = "/static/images/grading_notification.png"
......@@ -123,7 +125,8 @@ def combined_notifications(course, user):
except:
#Non catastrophic error, so no real action
notifications = {}
log.exception("Problem with getting notifications from controller query service.")
#This is a dev_facing_error
log.exception("Problem with getting notifications from controller query service for course {0} user {1}.".format(course_id, student_id))
if pending_grading:
img_path = "/static/images/grading_notification.png"
......
......@@ -60,6 +60,8 @@ ALERT_DICT = {
'Flagged Submissions': "Submissions have been flagged for review"
}
STUDENT_ERROR_MESSAGE = "Error occured while contacting the grading service. Please notify course staff."
STAFF_ERROR_MESSAGE = "Error occured while contacting the grading service. Please notify the development team. If you do not have a point of contact, please email Vik at vik@edx.org"
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
def staff_grading(request, course_id):
......@@ -96,7 +98,9 @@ def peer_grading(request, course_id):
return HttpResponseRedirect(problem_url)
except:
#This is a student_facing_error
error_message = "Error with initializing peer grading. Centralized module does not exist. Please contact course staff."
#This is a dev_facing_error
log.exception(error_message + "Current course is: {0}".format(course_id))
return HttpResponse(error_message)
......@@ -132,30 +136,34 @@ def student_problem_list(request, course_id):
problem_list = []
base_course_url = reverse('courses')
#try:
problem_list_json = controller_qs.get_grading_status_list(course_id, unique_id_for_user(request.user))
problem_list_dict = json.loads(problem_list_json)
success = problem_list_dict['success']
if 'error' in problem_list_dict:
error_text = problem_list_dict['error']
problem_list = []
else:
problem_list = problem_list_dict['problem_list']
for i in xrange(0, len(problem_list)):
problem_url_parts = search.path_to_location(modulestore(), course.id, problem_list[i]['location'])
problem_url = generate_problem_url(problem_url_parts, base_course_url)
problem_list[i].update({'actual_url': problem_url})
try:
problem_list_json = controller_qs.get_grading_status_list(course_id, unique_id_for_user(request.user))
problem_list_dict = json.loads(problem_list_json)
success = problem_list_dict['success']
if 'error' in problem_list_dict:
error_text = problem_list_dict['error']
problem_list = []
else:
problem_list = problem_list_dict['problem_list']
for i in xrange(0, len(problem_list)):
problem_url_parts = search.path_to_location(modulestore(), course.id, problem_list[i]['location'])
problem_url = generate_problem_url(problem_url_parts, base_course_url)
problem_list[i].update({'actual_url': problem_url})
"""
except GradingServiceError:
error_text = "Error occured while contacting the grading service"
#This is a student_facing_error
error_text = STUDENT_ERROR_MESSAGE
#This is a dev facing error
log.error("Problem contacting open ended grading service.")
success = False
# catch error if if the json loads fails
except ValueError:
error_text = "Could not get problem list"
#This is a student facing error
error_text = STUDENT_ERROR_MESSAGE
#This is a dev_facing_error
log.error("Problem with results from external grading service for open ended.")
success = False
"""
ajax_url = _reverse_with_slash('open_ended_problems', course_id)
......@@ -195,11 +203,17 @@ def flagged_problem_list(request, course_id):
problem_list = problem_list_dict['flagged_submissions']
except GradingServiceError:
error_text = "Error occured while contacting the grading service"
#This is a staff_facing_error
error_text = STAFF_ERROR_MESSAGE
#This is a dev_facing_error
log.error("Could not get flagged problem list from external grading service for open ended.")
success = False
# catch error if if the json loads fails
except ValueError:
error_text = "Could not get problem list"
#This is a staff_facing_error
error_text = STAFF_ERROR_MESSAGE
#This is a dev_facing_error
log.error("Could not parse problem list from external grading service response.")
success = False
ajax_url = _reverse_with_slash('open_ended_flagged_problems', course_id)
......@@ -283,7 +297,8 @@ def take_action_on_flags(request, course_id):
required = ['submission_id', 'action_type', 'student_id']
for key in required:
if key not in request.POST:
return HttpResponse(json.dumps({'success': False, 'error': 'Missing key {0}'.format(key)}),
#This is a staff_facing_error
return HttpResponse(json.dumps({'success': False, 'error': STAFF_ERROR_MESSAGE + 'Missing key {0} from submission. Please reload and try again.'.format(key)}),
mimetype="application/json")
p = request.POST
......@@ -297,5 +312,6 @@ def take_action_on_flags(request, course_id):
response = controller_qs.take_action_on_flags(course_id, student_id, submission_id, action_type)
return HttpResponse(response, mimetype="application/json")
except GradingServiceError:
log.exception("Error saving calibration grade, submission_id: {0}, submission_key: {1}, grader_id: {2}".format(submission_id, submission_key, grader_id))
return _err_response('Could not connect to grading service')
#This is a dev_facing_error
log.exception("Error taking action on flagged peer grading submissions, submission_id: {0}, action_type: {1}, grader_id: {2}".format(submission_id, action_type, grader_id))
return _err_response(STAFF_ERROR_MESSAGE)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment