Why is my TRY ... CATCH not working?
My CATCH is not catching the error, what am I doing wrong please?
HTML
JAVASCRIPT
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Github Profiles</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Github Profiles</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>JAVASCRIPT
async function getUser() {
try {
const res = await fetch('https://api.github.com/users/uiouiouiouiouio');
const data = await res.json()
console.log(data)
} catch (err) {
console.log('Error: ' + err)
}
}
getUser()async function getUser() {
try {
const res = await fetch('https://api.github.com/users/uiouiouiouiouio');
const data = await res.json()
console.log(data)
} catch (err) {
console.log('Error: ' + err)
}
}
getUser()