hjhan
|
d0c170c2a1
|
fix(log): 修复 DbUpdateException 日志丢失 InnerException 的问题
- NLog.config: exception layout 从 format=Message 改为 format=toString
原配置只渲染外层异常 Message,不递归 InnerException。DbUpdateException
外层 Message 永远是 "See the inner exception for details.",真正的 SQL
错误(主键冲突/字段超长/外键约束)全在 InnerException 里被吞掉。
改为 toString 后输出完整异常链(含 InnerException + 堆栈),全局生效。
- SwapTrade2Controller.tradeEditJson catch 块对齐其他 Controller:
e.Message → e.GetBaseException().Message,并补上 e.ToJson() 数据参数,
让前端也能拿到最内层错误信息。
验证:dotnet build 0 错误
|
2026-07-23 13:43:43 +08:00 |
|