courseware_access_exception.py 626 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
"""
This file contains the exception used in courseware access
"""
from django.http import Http404


class CoursewareAccessException(Http404):
    """
    Exception for courseware access errors
    """

    def __init__(self, access_response):
        super(CoursewareAccessException, self).__init__()
        self.access_response = access_response
        self.message = "Course not found."

    def to_json(self):
        """
        Creates a serializable JSON representation of an CoursewareAccessException.

        Returns:
            dict: JSON representation
        """
        return self.access_response.to_json()