Skip to content

[API] sylius_api_shop_order_order_item_post with not found order token throws 500, not 4** #18475

@quentint

Description

@quentint

Sylius version(s) affected

2.1.7

Description

When POSTing on /api/v2/shop/orders/{cartToken}/items (route is sylius_api_shop_order_order_item_post) and order with cartToken cannot be found, Sylius throws a 500 error, like this one:

{
  "@context": "\/api\/v2\/contexts\/Error",
  "@id": "\/api\/v2\/errors\/500",
  "@type": "hydra:Error",
  "detail": "Cart with given token has not been found.",
  "status": 500,
  "type": "\/errors\/500",
  "trace": ["..."],
  "hydra:description": "Cart with given token has not been found.",
  "hydra:title": "An error occurred"
}

I guess it should be a 4**, am I right?

How to reproduce

Create an order with:

POST /api/v2/shop/orders/not_a_thing/items
Content-Type: application/ld+json

{
  "productVariant": "{{existingProductVariant}}",
  "quantity": 1
}

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Potential BugPotential bugs or bugfixes, that needs to be reproduced.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions