Skip to content

Unfriendly Error Message on Fetching Non-Existent Marketing Campaign via GET /api/v1/settings/marketing/campaigns/{id} #156

Description

@sagarkumar-webkul

Title:

Unfriendly Error Message on Fetching Non-Existent Marketing Campaign via GET /api/v1/settings/marketing/campaigns/{id}

Description:

When attempting to fetch a marketing campaign using a non-existent ID, the API returns a 404 response containing internal exception traces instead of a clean, user-friendly message.

Affected Endpoint:

  • GET /api/v1/settings/marketing/campaigns/{id}

Preconditions:

  • The marketing campaign ID passed in the URL does not exist in the database.

Steps to Reproduce:

  1. Send a GET request to /api/v1/settings/marketing/campaigns/45 (assuming ID 45 does not exist).
  2. Observe the API response.

Actual Result:

Image
{
  "message": "No query results for model [Webkul\\Marketing\\Models\\Campaign] 45",
  "exception": "Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException",
  ...
}

Expected Result:

  • A clean and clear 404 response like:
{
  "message": "Marketing campaign with ID 45 not found.",
  "status": 404
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions