more error context

This commit is contained in:
jake 2023-01-31 20:00:03 -07:00
parent aac2e429ed
commit 0d3161e1b4

View File

@ -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;