Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

AccessError is a subclass of AccessResponse for cases where access is denied (has_access = False). Different subclasses of AccessError represent specific types of errors, because these different types may need various amounts of additional information. For example, a milestone error could contain exactly which pre-req course is missing. Some types of errors may not need additional fields. 

class subclass AccessError(AccessResponse):

  • Additional instance variables:

...

example subclasses: 

subclass MilestoneError(AccessError) (eventually could have its own subclasses: PrereqError and EntranceExam error)

  • error_code: "unfulfilled_milestones"
  • developer_message: "User has not completed the necessary milestones" 
  • user_message: "You have uncompleted milestones"

subclass StartDateError(AccessError)

  • error_code: "course_not_started"
  • developer_message: "Course does not start until {start} and user does not have staff access"
  • user_message: "This course hasn't started yet. Come back on {start} to see your videos."

...