Title:
Unfriendly Error Message When Updating Non-Existent Campaign via PUT /api/v1/settings/marketing/campaigns/{id}
Description:
When attempting to update a marketing campaign using an ID that does not exist, the API returns a 404 with an internal exception trace. This is not user-friendly and exposes internal paths and classes.
Affected Endpoint:
PUT /api/v1/settings/marketing/campaigns/{id}
Preconditions:
- Campaign ID 34 does not exist in the system.
Steps to Reproduce:
- Execute the following
PUT request:
curl -X PUT 'http://<host>/api/v1/settings/marketing/campaigns/34' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"name": "Spring Sale",
"subject": "Get Ready For Our Biggest Sale of the Year!",
"status": "1",
"marketing_template_id": "1",
"marketing_event_id": "8"
}'
- Ensure ID 34 does not exist.
- Observe the server response.
Actual Result:
{
"message": "No query results for model [Webkul\\Marketing\\Models\\Campaign] 34",
"exception": "Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException",
...
}
Expected Result:
{
"message": "Campaign with ID 34 not found.",
"status": 404
}
Title:
Unfriendly Error Message When Updating Non-Existent Campaign via
PUT /api/v1/settings/marketing/campaigns/{id}Description:
When attempting to update a marketing campaign using an ID that does not exist, the API returns a 404 with an internal exception trace. This is not user-friendly and exposes internal paths and classes.
Affected Endpoint:
PUT /api/v1/settings/marketing/campaigns/{id}Preconditions:
Steps to Reproduce:
PUTrequest:Actual Result:
{ "message": "No query results for model [Webkul\\Marketing\\Models\\Campaign] 34", "exception": "Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException", ... }Expected Result:
{ "message": "Campaign with ID 34 not found.", "status": 404 }