<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>错误链 on Tony Bai</title><link>https://tonybai.com/tags/%E9%94%99%E8%AF%AF%E9%93%BE/</link><description>Recent content in 错误链 on Tony Bai</description><generator>Hugo</generator><language>zh-cn</language><copyright>2004-2026 Tony Bai. 版权所有.</copyright><lastBuildDate>Fri, 20 Jun 2025 00:00:00 +0800</lastBuildDate><atom:link href="https://tonybai.com/tags/%E9%94%99%E8%AF%AF%E9%93%BE/index.xml" rel="self" type="application/rss+xml"/><item><title>Go errors.Join：是“天赐之物”还是“潘多拉魔盒”？——深入错误聚合的适用场景与最佳实践</title><link>https://tonybai.com/2025/06/20/about-errors-join/</link><pubDate>Fri, 20 Jun 2025 00:00:00 +0800</pubDate><guid>https://tonybai.com/2025/06/20/about-errors-join/</guid><description>本文永久链接 – https://tonybai.com/2025/06/20/about-errors-join 大家好，我是Tony Bai。 错误处理，无疑是软件开发中永恒的核心议题之一。Go 语言以其独特的、显式的错误处理机制（即 error 作为普通值返回）而著称，这种设计强调了对错误的关注和及时处理。自 Go 1.13 引入错误包装 (wrapping) 机制以来，Go 的错误处理能力...</description></item><item><title>要么返回错误值，要么输出日志，别两样都做</title><link>https://tonybai.com/2024/04/14/either-return-error-or-log-them-do-not-do-both/</link><pubDate>Sun, 14 Apr 2024 00:00:00 +0800</pubDate><guid>https://tonybai.com/2024/04/14/either-return-error-or-log-them-do-not-do-both/</guid><description>本文永久链接 – https://tonybai.com/2024/04/14/either-return-error-or-log-them-do-not-do-both 1\. 缘起 ------ 这周，一个产品团队内进行Go代码评审时，得到了一个结论：所有的if err != nil的地方都应该输出错误日志。然而，这种做法并不是最佳实践，它存在一些问题。 首先，打印过多的错误日志会导致日志文...</description></item><item><title>Go错误处理：错误链使用指南</title><link>https://tonybai.com/2023/05/14/a-guide-of-using-go-error-chain/</link><pubDate>Sun, 14 May 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/05/14/a-guide-of-using-go-error-chain/</guid><description>本文永久链接 – https://tonybai.com/2023/05/14/a-guide-of-using-go-error-chain 0\. Go错误处理简要回顾 -------------- Go是一种非常强调错误处理的编程语言。在Go中，错误被表示为实现了error接口的类型的值，error接口只有一个方法： type error interface { Error() string...</description></item></channel></rss>