Skip to content

Commit b273c3d

Browse files
committed
Update error-handling:
- Apply review comment - Fix a broken link
1 parent 74fca9c commit b273c3d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

1.6/ja/book/error-handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ fn main() {
11021102
<!-- standard library. You will see it again and again. -->
11031103
最初の2つの問題は、[`std::io::Error`](../std/io/struct.Error.html) 型で記述されます。
11041104
これは [`std::fs::File::open`](../std/fs/struct.File.html#method.open)[`std::io::Read::read_to_string`](../std/io/trait.Read.html#method.read_to_string) のリターン型からわかります。
1105-
(ちなみにどちらも、以前紹介した [`Result` 型エイリアスのイディオム](#the-result-type-alias-idiom) を用いています。
1105+
(ちなみにどちらも、以前紹介した [`Result` 型エイリアスのイディオム](#result-型エイリアスを用いたイディオム) を用いています。
11061106
`Result` 型のところをクリックすると、いま言った [型エイリアスを見たり](../std/io/type.Result.html)、必然的に、中で使われている `io::Error` 型も見ることになるでしょう。)
11071107
3番目の問題は [`std::num::ParseIntError`](../std/num/struct.ParseIntError.html) 型で記述されます。
11081108
特にこの `io::Error` 型は標準ライブラリ全体に *深く浸透しています*
@@ -1465,7 +1465,7 @@ fn main() {
14651465
ここでの変更点は、(エラーを文字列に変換する) `map_err(|e| e.to_string())` を、`map_err(CliError::Io)``map_err(CliError::Parse)` へ切り替えたことです。
14661466
こうして *呼び出し元* が、ユーザーに対してどの程度の詳細を報告するか決められるようになりました。
14671467
`String` をエラー型として用いることは、事実上、呼び出し元からこうした選択肢を奪ってしまいます。
1468-
`CliError` のような独自の `enum` エラー型を用いることは、 *構造化データ* によるエラーの説明だけでなく、これまでと同様の使いやすさをもたらします。
1468+
`CliError` のような独自の `enum` エラー型を用いることは、 *構造化されたデータ* によるエラーの説明だけでなく、これまでと同様の使いやすさをもたらします。
14691469

14701470
<!-- A rule of thumb is to define your own error type, but a `String` error type -->
14711471
<!-- will do in a pinch, particularly if you're writing an application. If you're -->

0 commit comments

Comments
 (0)