Helper

StockStateExceptionMessageFormatter

Magento\CatalogInventoryGraphQl\Helper\Error\MessageFormatters\StockStateExceptionMessageFormatter

What it does

This helper class formats error messages specifically for stock/inventory exceptions in GraphQL API responses.

When a StockStateException occurs (like when an item is out of stock or quantity is insufficient), it converts the exception into a GraphQL-friendly format while preserving the original error message.

Developers use this to ensure inventory-related errors are properly communicated through the GraphQL API.

Public Methods

  • getFormatted()