Skip to content

Commit

Permalink
Output console error and alert if there is an error in loading the API
Browse files Browse the repository at this point in the history
  • Loading branch information
helenclx committed Mar 23, 2024
1 parent efffd88 commit ccfa172
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion advice-generator-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const fetchData = async () => {
const data = await res.json();
getAdvice(data.slip);
} catch (err) {
console.log(err);
console.error(err);
alert(`There was an error in loading the advice\n\nError:\n${err}`);
}
};

Expand Down

0 comments on commit ccfa172

Please sign in to comment.