質問編集履歴
1
typeof を使った場合のエラーメッセージを記入
title
CHANGED
File without changes
|
body
CHANGED
@@ -11,4 +11,19 @@
|
|
11
11
|
|
12
12
|
|
13
13
|
```
|
14
|
-
でhogeにerrorが入っていることから条件分岐させて処理したいです。
|
14
|
+
でhogeにerrorが入っていることから条件分岐させて処理したいです。
|
15
|
+
|
16
|
+
typeofを使用した場合
|
17
|
+
下記のような状態になってしまいます
|
18
|
+
```エラー
|
19
|
+
Unhandled Rejection (TypeError): Cannot read property 'status' of undefined
|
20
|
+
Show._callee3$
|
21
|
+
src/Courses.js:227
|
22
|
+
224 | const course = await this.props.api.showCourse(
|
23
|
+
225 | this.props.match.params.courseId
|
24
|
+
226 | );
|
25
|
+
> 227 | if (typeof course.response.status !=="undefined") {
|
26
|
+
228 | this.setState({ isValidUrl: false });
|
27
|
+
229 | return;
|
28
|
+
230 | }
|
29
|
+
```
|