-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Title:
Unfriendly Error Message for Invalid Webhook ID on DELETE /api/v1/settings/webhooks/{id}
Description:
When attempting to delete a webhook using a non-existent ID, the API returns a detailed Laravel exception message. This is not suitable for production as it exposes internal code structure and is not user-friendly.
Affected Endpoint:
DELETE /api/v1/settings/webhooks/{id}
Preconditions:
- Krayin REST API installed and running.
- Valid token and headers (if required).
Steps to Reproduce:
- Send a
DELETErequest to/api/v1/settings/webhooks/16(assuming ID 16 does not exist). - Observe the response.
Actual Result:
{
"message": "No query results for model [Webkul\\Automation\\Models\\Webhook] 16",
"exception": "Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException",
...
}Expected Result:
A cleaner and user-oriented JSON response, for example:
{
"message": "Webhook with ID 16 not found.",
"status": 404
}Suggested Fix:
- Catch
ModelNotFoundExceptionin the controller or globally. - Return a user-friendly message such as
"Webhook with ID {id} not found.". - Ensure
APP_DEBUG=falsein.envto suppress trace output in production.
Benefit:
- Provides a clean API interface for clients.
- Avoids exposing internal Laravel paths or stack traces.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels