From 0d3161e1b44debd4fb2b3e2da2e3c6ca8a4d03be Mon Sep 17 00:00:00 2001 From: jake Date: Tue, 31 Jan 2023 20:00:03 -0700 Subject: [PATCH] more error context --- src/ship/items/actions.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ship/items/actions.rs b/src/ship/items/actions.rs index 53a59db..4351d09 100644 --- a/src/ship/items/actions.rs +++ b/src/ship/items/actions.rs @@ -5,6 +5,7 @@ use async_std::sync::Arc; use std::future::Future; use std::pin::Pin; use std::iter::IntoIterator; +use anyhow::Context; use libpso::packet::{ship::Message, messages::GameMessage}; use crate::ship::map::MapArea; @@ -112,7 +113,8 @@ where let mut inventory = item_state.inventory(&character_id).await?; let item = inventory.remove_item(&item_id, amount) .await - .ok_or_else(|| ItemStateError::NoInventoryItem(item_id))?; + .ok_or_else(|| ItemStateError::NoInventoryItem(item_id)) + .with_context(|| format!("{inventory:#?}"))?; transaction.gateway().set_character_inventory(&character_id, &inventory.as_inventory_entity(&character_id)).await?; item_state.set_inventory(inventory).await;