Order/EventListener/OrderListener.php
public function onPrepare(ResourceEventInterface $event)
    {
        $order = $this->getSaleFromEvent($event);

        if (!OrderStates::isStockableState($order->getState())) {
            throw new IllegalOperationException(
                "Order is not ready for shipment preparation"
            );
        }
    }
public function onPrepare(ResourceEventInterface $event)
    {
        $order = $this->getSaleFromEvent($event);

        if (!OrderStates::isStockableState($order->getState())) {
            throw new IllegalOperationException(
                "Order is not ready for shipment preparation"
            );
        }
    }
Prepare event handler.

@param ResourceEventInterface $event

@throws IllegalOperationException