Browse Source

more error context

pull/128/head
jake 1 year ago
parent
commit
0d3161e1b4
  1. 4
      src/ship/items/actions.rs

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

Loading…
Cancel
Save