Skip to content

API return 404 when a pre-enrollment already exists #291

Description

@BryanttV

Description

When a pre-enrollment already exists the API returns a 404 status code. This code is not the most appropriate. It should be a 400 status code.

Originally posted by @mariajgrimaldi in #289 (comment)

Possible Solution

The NotFound class by default has this status code:

raise NotFound(f'Pre-enrollment already exists for email: {email} course_id: {course_id}') from IntegrityError

Maybe using the ValidationError class (400) in this case is better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions