Skip to content

Commit

Permalink
Add exception msg
Browse files Browse the repository at this point in the history
  • Loading branch information
ipdae committed Jul 10, 2024
1 parent 3d7d4aa commit 3f41856
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Lib9c/Action/ItemEnhancement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public override IWorld Execute(IActionContext context)
{
if (HammerBannedTypes.Contains(enhancementEquipment.ItemSubType))
{
throw new InvalidItemCountException();
throw new InvalidItemTypeException($"target equipment({enhancementEquipment.ItemSubType}) does not allow use hammer");
}

int hammerCount = 0;
Expand All @@ -229,15 +229,15 @@ public override IWorld Execute(IActionContext context)
{
if (!HammerIds.Contains(kv.Key))
{
throw new InvalidItemCountException();
throw new InvalidItemCountException("target material is not hammer");
}

hammerCount += kv.Value;
}

if (hammerCount <= 0)
{
throw new InvalidItemCountException();
throw new InvalidItemCountException("hammer must be greater than 0");
}
}

Expand Down Expand Up @@ -327,6 +327,12 @@ public override IWorld Execute(IActionContext context)
var exp = Equipment.GetHammerExp(hammerId, enhancementCostSheet);
hammerExp += exp * hammerCount;
}
else
{
throw new NotEnoughMaterialException(
$"{addressesHex} Aborted as the signer does not have a necessary material ({hammerId})."
);
}
}
enhancementEquipment.Exp += hammerExp;

Expand Down

0 comments on commit 3f41856

Please sign in to comment.