Skip to content

fix(platform/api): catch DoesNotExist in quiz question/answer update to return 400 instead of 500 #649

Description

@payamnj

Problem

During nested quiz update in SingleCourseContentView._update_course_content_atomic, the code calls .get(id=...) on question and answer querysets without error handling:

  • quiz.questions.get(id=question_data.id)
  • question.answers.get(id=answer_data.id)

A stale or cross-quiz ID raises DoesNotExist which results in a 500 response instead of a structured 400/404.

Suggestion

Catch DoesNotExist for both lookups and return a validation-style error response (400 with a descriptive message).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions