<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Rust on mephisto.cc</title><link>https://mephisto.cc/tags/rust/</link><description>Recent content in Rust on mephisto.cc</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><copyright>Copyright © 2021-2022 mephisto.cc. All rights reserved.</copyright><lastBuildDate>Wed, 28 Oct 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://mephisto.cc/tags/rust/index.xml" rel="self" type="application/rss+xml"/><item><title>使用Trapfall收集错误信息</title><link>https://mephisto.cc/tech/trapfall/</link><pubDate>Wed, 28 Oct 2026 00:00:00 +0000</pubDate><guid>https://mephisto.cc/tech/trapfall/</guid><description>
昨天在看项目访问日志的时候，发现了个异常。 一个新疆·喀什用户 POST 请求 422, 哪个接口大部分时候应该是触发 400, FastAPI 的 422 是在路由函数执行之前，由内置异常处理器抛出的，路由内部代码还没跑，普通日志拿不到原始请求体。 想要专门捕获 Pydantic 校验失败（422），拿到完整报错 + 原始请求 body，或者 5xx 等错误，定位代码块，拿到请求 body 什么的，通常需要 Sentry 等专业方案
&lt;p&gt;&lt;a href="https://mephisto.cc/tech/trapfall/"&gt;阅读更多&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>