顶栏加固:交易账户/期权字段缺省与币金额格式化吞掉Undefined,降低再发500风险

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-20 17:33:10 +08:00
parent 2e2d5ddda0
commit d4d2110412
3 changed files with 6 additions and 5 deletions
+2 -1
View File
@@ -121,7 +121,8 @@ def _fmt_coin_amount(v: float | None, *, min_amt: float = 1e-6) -> str | None:
return None
try:
n = float(v)
except (TypeError, ValueError):
except Exception:
# Jinja Undefined 等也吞掉,避免顶栏 float(Undefined) → HTTP 500
return None
if n < min_amt:
return None