diff options
author | Ibrahim Mkusa <ibrahimmkusa@gmail.com> | 2023-05-28 19:11:18 -0400 |
---|---|---|
committer | Ibrahim Mkusa <ibrahimmkusa@gmail.com> | 2023-05-28 19:11:18 -0400 |
commit | fb9fa30ae9dc6f407ca4c103579bbb42c978809b (patch) | |
tree | 5f2bc93b0644a3cc733bc88c20a078e73bc99363 /part2 | |
parent | b4da7cd76e5ce4f2285a9a4a66ff06fd592f85d1 (diff) |
ex3.19 added skeleton for error handling.[TODO] fail gracefully
Diffstat (limited to 'part2')
-rw-r--r-- | part2/phonebook/src/App.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/part2/phonebook/src/App.js b/part2/phonebook/src/App.js index fa46962..0de0544 100644 --- a/part2/phonebook/src/App.js +++ b/part2/phonebook/src/App.js @@ -94,6 +94,10 @@ const App = () => { .create(newPerson) .then(response => console.log(response)) + .catch(error => { + console.log(error.response.data.error) + setErrorMessage(error.response.data.error) + }) setPersons(persons.concat(newPerson)) } } |