mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 12:51:35 +00:00
🎨 Add Exception Handler in Damage Analysis
This commit is contained in:
parent
14a9b8a55c
commit
a45db101c8
@ -42,6 +42,7 @@ from utils.uid import mask_number
|
||||
try:
|
||||
from python_genshin_artifact.calculator import get_damage_analysis, get_transformative_damage
|
||||
from python_genshin_artifact.enka.enka_parser import enka_parser
|
||||
from python_genshin_artifact.error import JsonParseException, EnkaParseException
|
||||
from python_genshin_artifact.models.calculator import CalculatorConfig
|
||||
from python_genshin_artifact.models.skill import SkillInfo
|
||||
|
||||
@ -577,8 +578,14 @@ class RenderTemplate:
|
||||
character_cn_name = idToName(self.character.id)
|
||||
damage_config = self.damage_config.get(character_cn_name)
|
||||
if damage_config is not None:
|
||||
data["damage_function_available"] = True
|
||||
try:
|
||||
data["damage_info"] = self.render_damage(damage_config)
|
||||
except JsonParseException as _exc:
|
||||
logger.error(str(_exc))
|
||||
except EnkaParseException as _exc:
|
||||
logger.error(str(_exc))
|
||||
else:
|
||||
data["damage_function_available"] = True
|
||||
|
||||
return await self.template_service.render(
|
||||
"genshin/player_card/player_card.jinja2",
|
||||
|
Loading…
Reference in New Issue
Block a user