pyoe2_craftpath/api/
errors.rs

1use thiserror::Error;
2
3use crate::api::{
4    item::Item,
5    types::{
6        AffixId, AffixLocationEnum, AffixSpecifier, BaseGroupId, BaseItemId, EssenceId, ItemLevel,
7    },
8};
9
10#[derive(Debug, Error)]
11pub enum CraftPathError {
12    #[error(
13        "Could not find affixes that can be put on base item '{0:?}'. Item info provider correct?"
14    )]
15    ItemWithoutAffixInformation(BaseItemId),
16    #[error("Could not find affix definition for '{0:?}'.")]
17    AffixWithoutDefinition(AffixId),
18    #[error("Could not find affix essence for '{0:?}'.")]
19    AffixWithoutEssence(AffixId),
20    #[error("Could not find definition for '{0:?}'.")]
21    BaseGroupWithoutDefinition(BaseGroupId),
22    #[error("Could not find essence definition for '{0:?}'.")]
23    EssenceWithoutDefinition(EssenceId),
24    #[error("Base item '{0:?}' without base group.")]
25    BaseItemWithoutBaseGroup(BaseItemId),
26    #[error(
27        "The target item could not be reached from the given starting item. If you think that it is a bug, open an issue at https://github.com/WladHD/pyoe2-craftpath/issues"
28    )]
29    ItemMatrixCouldNotReachTarget(),
30    #[error(
31        "Could not reach required affix due to level constraints. Minimal item level is '{0:?}' (current {1:?}) for required affix '{2:?}' ..."
32    )]
33    ItemUnreachableMinLevelConstraint(ItemLevel, ItemLevel, AffixId),
34    #[error("Affix '{1:?}' is unreachable with the item configuration provided in {0:?}.")]
35    ItemUnreachable(Item, AffixSpecifier),
36    #[error("Perfect Essence requires intermediary step to be applied.")]
37    EssenceIntermediaryStepRequired(AffixLocationEnum),
38    #[error("Defined RAM limit of '{0}' was reached and program was aborted.")]
39    RamLimitReached(String),
40}