blog.bouzuya.net

2026-03-18 Error::custom

bouzuya/tsukota-webbouzuya/bouzuya-firestore-client を組み込もうとしている。 Firestore::run_transaction に渡した callback から Error を構築できなくて困った。

bouzuya-firestore-client::ErrorError::custom(e: impl Into<Box<dyn std::error::Error + Send + Sync>>) を追加して対応する。

std::io::Error のように Error::new(ErrorKind, E) の形や Error::other(E) という名前も考えたものの、分類としての other というよりはユーザー定義の custom error のほうが適切かなと思い custom にした。


今日のコミット。