Currently, the API is returning incorrect error messages in response to certain requests. This issue requires validation and adjustments to ensure accurate error reporting aligns with the expected behavior.
Steps to Reproduce
Problem 1: Incorrect Error Message for Invalid statusId or vehicleId
Make a POST request to /api/v1/routes/status with a invalid statusId or vehicleId.
It returns an error message related to city not found, intead of a proper message to each field.
Problem 2: Inconsistent Error Message for Non-existent routeId
Make a GET request to /api/v1/routes/:routeId/status with a routeId that is a valid UUID, but does not exists in the database.
It returns an error message related to routenot found, instead of a route status not found.
Problem 3: Misleading Error Message for Non-existent statusId
Make a DELETE request to /api/v1/routes/status/:statusId with a statusId that is a valid UUID, but does not exists in the database.
It returns an error message related to route status not found, instead of a route not found.
Problem 4: Lack of Error Message for Non-existent collaboratorId
Make a GET request to /api/v1/collaborators/:collaboratorId with a collaboratorId that is a valid UUID, but does not exists in the database.
It does not returns a proper error message and hint.
Problem 5: Incorrect Error Message for Existing emailor cpf
Make a POST request to /api/v1/collaborators with a email or cpf that already exists in the database.
It returns an error message related to state already exists, instead of a collaborator already exists.
Problem 6: Lack of Error Message for Non-existent collaboratorId in DELETE Request
Make a DELETE request to /api/v1/collaborators/:collaboratorId with a collaboratorId that is a valid UUID, but does not exists in the database.
It does not returns a proper error message and hint.
Expected Behavior
The API should return error messages that accurately reflect the nature of the issue encountered during the request.
Actual Behavior
Incorrect error messages are returned, which do not provide useful information for debugging or resolving the issue.
Additional Information
This issue significantly impacts the reliability of error reporting. The incorrect error messages not only impede effective troubleshooting but also degrade the overall user experience by obscuring the root causes of issues.
Proposed Solution: Implement robust validation checks to ensure that error messages accurately correspond to the encountered scenarios. Additionally, revise the error handling logic to deliver clear and informative messages that assist users and developers in swiftly identifying and resolving problems.
Description
Currently, the API is returning incorrect error messages in response to certain requests. This issue requires validation and adjustments to ensure accurate error reporting aligns with the expected behavior.
Steps to Reproduce
Problem 1: Incorrect Error Message for Invalid
statusId
orvehicleId
POST
request to/api/v1/routes/status
with a invalidstatusId
orvehicleId
.Problem 2: Inconsistent Error Message for Non-existent
routeId
GET
request to/api/v1/routes/:routeId/status
with arouteId
that is a valid UUID, but does not exists in the database.Problem 3: Misleading Error Message for Non-existent
statusId
DELETE
request to/api/v1/routes/status/:statusId
with astatusId
that is a valid UUID, but does not exists in the database.Problem 4: Lack of Error Message for Non-existent
collaboratorId
GET
request to/api/v1/collaborators/:collaboratorId
with acollaboratorId
that is a valid UUID, but does not exists in the database.Problem 5: Incorrect Error Message for Existing
email
orcpf
POST
request to/api/v1/collaborators
with aemail
orcpf
that already exists in the database.Problem 6: Lack of Error Message for Non-existent
collaboratorId
in DELETE RequestDELETE
request to/api/v1/collaborators/:collaboratorId
with acollaboratorId
that is a valid UUID, but does not exists in the database.Expected Behavior
The API should return error messages that accurately reflect the nature of the issue encountered during the request.
Actual Behavior
Incorrect error messages are returned, which do not provide useful information for debugging or resolving the issue.
Additional Information
This issue significantly impacts the reliability of error reporting. The incorrect error messages not only impede effective troubleshooting but also degrade the overall user experience by obscuring the root causes of issues.
Proposed Solution: Implement robust validation checks to ensure that error messages accurately correspond to the encountered scenarios. Additionally, revise the error handling logic to deliver clear and informative messages that assist users and developers in swiftly identifying and resolving problems.
Environment