teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

追加

2019/06/15 12:36

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -16,5 +16,14 @@
16
16
  しかし、最下部で`catch(function(error){...}`という処理も記述されており、これらのエラー処理の違いがわかりません
17
17
  エラー時の処理は全く同様に見受けられたのですが、何か違いがあるのでしょうか?
18
18
 
19
-
19
+ たとえば下記のような記述でも処理は同様でしょうか?
20
+ ```javascript
21
+ fetch('flowers.jpg').then(function(response) {
22
+ return response.blob();
23
+ }).then(function(myBlob) {
24
+ var objectURL = URL.createObjectURL(myBlob);
25
+ myImage.src = objectURL;
26
+ }).catch(function(error) {
20
- https://developer.mozilla.org/ja/docs/Web/API/Fetch_API/Using_Fetch#Checking_that_the_fetch_was_successful
27
+ console.log('There has been a problem with your fetch operation: Network response was not ok.;
28
+ });
29
+ ```