Skip to content

fix: return 404 instead of 500 when deleting non-existent member #251

Description

@ninzizah

Guidance Metadata

  • Type: Bug Fix
  • Difficulty: Easy (Good First Issue)
  • Category: Error Handling

Description

The deleteMember controller does not verify if the member exists before calling the delete service. If the member is not found, Prisma throws a RecordNotFound error which results in a 500 Internal Server Error response.

Acceptance Criteria

  • Check if the member exists first in deleteMember inside src/controllers/member.controller.ts.
  • Return a clean 404 response with Member not found if they do not exist.
  • Ensure all tests pass (npm test).

Files to Modify

  • src/controllers/member.controller.ts

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