Title:
500 Error on Deleting Non-Existent Marketing Event via DELETE /api/v1/settings/marketing/events/{id}
Description:
When a DELETE request is sent to /api/v1/settings/marketing/events/{id} using a non-existent ID, the API returns a 500 Internal Server Error with the message:
"clone method called on non-object".
This occurs due to the absence of a null check before cloning the model, and it should instead return a user-friendly 404 response.
Affected Endpoint:
DELETE /api/v1/settings/marketing/events/{id}
Preconditions:
- Krayin REST API is running.
- The given marketing event ID does not exist.
Steps to Reproduce:
- Send a
DELETE request to /api/v1/settings/marketing/events/24 (assuming ID 24 does not exist).
- Observe the response.
Actual Result:
- HTTP 500 Internal Server Error
{
"message": "clone method called on non-object",
"exception": "Error",
...
}
Expected Result:
{
"message": "Marketing event with ID 24 not found.",
"status": 404
}