Description
When attempting to register a customer or provider with an email address that already exists in the system, the application responds with an HTTP 500 Internal Server Error.
This behavior is misleading, since a 500 status code indicates a server-side failure, while this scenario is actually a client-side validation or business rule error.
Steps to reproduce
Register a customer or provider with a valid email address.
Attempt to register another customer or provider using the same email address.
Observe the HTTP response.
Actual behavior
The API returns HTTP 500 Internal Server Error.
Expected behavior
The API should return an HTTP status code that properly represents the situation, such as:
409 Conflict (resource already exists), or
400 Bad Request (invalid request due to duplicate email),
along with a clear and meaningful error message indicating that the email address is already registered.
Why this matters
Returning a 500 status code for this case:
Makes error handling harder for API consumers.
Suggests a server malfunction where there is none.
Breaks common RESTful API conventions.
Using a more appropriate HTTP status code would improve API clarity, correctness, and developer experience.
Description
When attempting to register a customer or provider with an email address that already exists in the system, the application responds with an HTTP 500 Internal Server Error.
This behavior is misleading, since a 500 status code indicates a server-side failure, while this scenario is actually a client-side validation or business rule error.
Steps to reproduce
Register a customer or provider with a valid email address.
Attempt to register another customer or provider using the same email address.
Observe the HTTP response.
Actual behavior
The API returns HTTP 500 Internal Server Error.
Expected behavior
The API should return an HTTP status code that properly represents the situation, such as:
409 Conflict (resource already exists), or
400 Bad Request (invalid request due to duplicate email),
along with a clear and meaningful error message indicating that the email address is already registered.
Why this matters
Returning a 500 status code for this case:
Makes error handling harder for API consumers.
Suggests a server malfunction where there is none.
Breaks common RESTful API conventions.
Using a more appropriate HTTP status code would improve API clarity, correctness, and developer experience.