From 723a0b9c36bd5884c8bc6c8143ed223b75c5f9e4 Mon Sep 17 00:00:00 2001 From: SuperSimpleDev Date: Tue, 30 Apr 2024 13:20:09 -0400 Subject: [PATCH] 18f Solution --- 2-copy-of-code/lesson-18/lesson18.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/2-copy-of-code/lesson-18/lesson18.html b/2-copy-of-code/lesson-18/lesson18.html index 1c1c350..b60a730 100644 --- a/2-copy-of-code/lesson-18/lesson18.html +++ b/2-copy-of-code/lesson-18/lesson18.html @@ -50,9 +50,14 @@ */ async function getAmazon() { - const response = await fetch('https://amazon.com'); - const text = await response.text(); - console.log(text); + try { + const response = await fetch('https://amazon.com'); + const text = await response.text(); + console.log(text); + + } catch (error) { + console.log('CORS error. You request was blocked by the backend.'); + } } getAmazon();