search
AI OnAI Off
I will file a bug to Commerce team, thank you for bringing this into our attention and apologies for the inconveniences.
The bug is now fixed and will be in an upcoming release. Thanks for letting us know!
When a CSR API call fails on the server, Order Management doesn’t show the error. The dialog just stays open, so the rep thinks the button did nothing.
Versions: Found and worked around on EPiServer.Commerce.UI.CustomerService 14.46.2 (Commerce 14.46.2, CMS 12.34.8, .NET 10). The latest 14.x (14.47.0) and 15.x (15.5.0) have the same code.
Why it happens
CsrExceptionFilterAttributereturnsnew ObjectResult(new { Message, MessageDetail, StatusCode = 500 }). The 500 is only in the body, so the response goes out as HTTP 200.messageDetailinto a message, but only for non-2xx responses, so it never runs for these errors.createCustomerOrdercallsinitPurchaseOrderwith no try/catch, so the rejection goes unhandled and no notification appears. With the current HTTP 200 response it’s worse: the error body is treated as a draft order and Prepare Order opens with it.To reproduce: throw from a
SavingOrderhandler, then click Create New Cart in Order Management. The network tab shows a 200 with"statusCode": 500in the body, and no message appears.Suggested fix
new ObjectResult(...) { StatusCode = 500 }.createCustomerOrderin the same try/catch andshowNotificationthatcreateOrRefreshCartalready uses.Workaround: an always-run result filter that applies the status from the body. It has to be
IAlwaysRunResultFilter, because ordinary result filters are skipped when an exception filter supplies the result.public class CsrErrorStatusCodeResultFilter : IAlwaysRunResultFilter { public void OnResultExecuting(ResultExecutingContext context) { if (context.Result is not ObjectResult { StatusCode: null, Value: { } value } result) return; var type = value.GetType(); if (type.GetProperty("MessageDetail") != null && type.GetProperty("StatusCode")?.GetValue(value) is int status && status >= 400) result.StatusCode = status; } public void OnResultExecuted(ResultExecutedContext context) { } }The filter fixes Create New Cart, but that relies on the shape of an internal anonymous type. Create New Order still needs a client fix.