Browse Source

more error context

pull/128/head
jake 2 years 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::future::Future;
use std::pin::Pin; use std::pin::Pin;
use std::iter::IntoIterator; use std::iter::IntoIterator;
use anyhow::Context;
use libpso::packet::{ship::Message, messages::GameMessage}; use libpso::packet::{ship::Message, messages::GameMessage};
use crate::ship::map::MapArea; use crate::ship::map::MapArea;
@ -112,7 +113,8 @@ where
let mut inventory = item_state.inventory(&character_id).await?; let mut inventory = item_state.inventory(&character_id).await?;
let item = inventory.remove_item(&item_id, amount) let item = inventory.remove_item(&item_id, amount)
.await .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?; transaction.gateway().set_character_inventory(&character_id, &inventory.as_inventory_entity(&character_id)).await?;
item_state.set_inventory(inventory).await; item_state.set_inventory(inventory).await;

Loading…
Cancel
Save