Log in
Model

CannotSwitchStoreException

Magento\Store\Model\StoreSwitcher\CannotSwitchStoreException

What it does

This is a custom exception class that developers use when a store switching operation fails in Magento 2.

It extends RuntimeException and provides a default error message 'The store cannot be switched.' Developers should throw this exception in store switcher implementations when conditions prevent switching between stores, such as invalid store codes or permission issues.