Skip to content

Commit e159e74

Browse files
committed
Translate error-boundaries lint rule
1 parent 37a7f80 commit e159e74

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎src/content/reference/eslint-plugin-react-hooks/lints/error-boundaries.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ title: error-boundaries
44

55
<Intro>
66

7-
Validates usage of Error Boundaries instead of try/catch for errors in child components.
7+
子コンポーネントのエラーを、エラーバウンダリではなく try/catch で処理しようとしていないか検証します。
88

99
</Intro>
1010

11-
## Rule Details {/*rule-details*/}
11+
## ルールの詳細 {/*rule-details*/}
1212

13-
Try/catch blocks can't catch errors that happen during React's rendering process. Errors thrown in rendering methods or hooks bubble up through the component tree. Only [Error Boundaries](/reference/react/Component#catching-rendering-errors-with-an-error-boundary) can catch these errors.
13+
React のレンダー処理中に起きるエラーは、try/catch ブロックではキャッチできません。レンダーを行うメソッドやフック内でスローされたエラーは、コンポーネントツリーを上へと伝播します。これらのエラーをキャッチできるのは、[エラーバウンダリ](/reference/react/Component#catching-rendering-errors-with-an-error-boundary)だけです。
1414

15-
### Invalid {/*invalid*/}
15+
### 無効な例 {/*invalid*/}
1616

17-
Examples of incorrect code for this rule:
17+
このルールに違反するコードの例です。
1818

1919
```js {expectedErrors: {'react-compiler': [4]}}
2020
// ❌ Try/catch won't catch render errors
@@ -27,9 +27,9 @@ function Parent() {
2727
}
2828
```
2929

30-
### Valid {/*valid*/}
30+
### 有効な例 {/*valid*/}
3131

32-
Examples of correct code for this rule:
32+
このルールに従ったコードの例です。
3333

3434
```js
3535
// ✅ Using error boundary
@@ -42,11 +42,11 @@ function Parent() {
4242
}
4343
```
4444

45-
## Troubleshooting {/*troubleshooting*/}
45+
## トラブルシューティング {/*troubleshooting*/}
4646

47-
### Why is the linter telling me not to wrap `use` in `try`/`catch`? {/*why-is-the-linter-telling-me-not-to-wrap-use-in-trycatch*/}
47+
### なぜ `use` を `try`/`catch` で囲まないようにリンタに指摘されるのか {/*why-is-the-linter-telling-me-not-to-wrap-use-in-trycatch*/}
4848

49-
The `use` hook doesn't throw errors in the traditional sense, it suspends component execution. When `use` encounters a pending promise, it suspends the component and lets React show a fallback. Only Suspense and Error Boundaries can handle these cases. The linter warns against `try`/`catch` around `use` to prevent confusion as the `catch` block would never run.
49+
`use` フックは、通常の意味でエラーをスローするのではなく、コンポーネントの実行をサスペンドします。`use` が処理中のプロミスを受け取ると、コンポーネントをサスペンドし、React にフォールバックを表示させます。このようなケースに対応できるのは、サスペンスとエラーバウンダリだけです。`catch` ブロックが実行されることはないため、混乱を避けるために、リンタは `use` を `try`/`catch` で囲むことに対して警告します。
5050

5151
```js {expectedErrors: {'react-compiler': [5]}}
5252
// ❌ Try/catch around `use` hook

0 commit comments

Comments
 (0)