Aller au contenu

Exceptions

tilttek/inventory

Toute exception de la bibliothèque implémente Exception\InventoryException : attrapez celle-ci pour les attraper toutes.

ExceptionLancée quandMessage
InventoryRefusedLes règles de l'inventaire refusent l'acte ; refusal dit pourquoiLe message du refus, plus bas
UnknownInventoryAucun inventaire ne contient la référence, ou aucun objet la cléNo inventory is known as "…"., The inventory "…" holds no item under the key "…".
InvalidInventoryUn nom, une clé, une raison, une quantité, un encombrement, un contenant, un lieu, des règles de transport, une capacité ou une limite hors limites ; une partie d'une pile déplacée sans nouvelle clé ; un transfert vers le même inventaireCe qui est hors limites, et la limite

InventoryRefused étend DomainException, UnknownInventory OutOfBoundsException, InvalidInventory InvalidArgumentException.

RefusalMessage
AlreadyOpenAn inventory already holds this reference.
TooManyInventoriesThis owner holds as many inventories as allowed.
ItemExistsThe inventory already holds an item under this key.
TooManyItemsThe inventory holds as many items as allowed.
NotEnoughThe inventory holds fewer of this item than asked.
NotAContainerThis item is not a container.
ContainerCycleA container cannot go inside itself or what it holds.
TooDeepContainers would nest deeper than allowed.
ContainerFullThe container cannot hold this much.
ContainerNotEmptyThe container still holds items.
SingleContainerA container is always a single item.
NotCarriedOnly an item a carrier holds in hand or on them can be equipped.
OverCapacityThe carrier cannot carry this much.

Une nouvelle valeur est vérifiée avant les limites et les clés déjà prises : ouvrir un inventaire ou ajouter un objet avec un nom ou une clé invalide lance InvalidInventory même quand la référence ou la clé est déjà prise. Un contenant que nomme la destination mais que l'inventaire ne contient pas lance UnknownInventory.