Created
November 1, 2017 04:56
-
-
Save SastraNababan/abc17da38ba26d57a66987194267eda9 to your computer and use it in GitHub Desktop.
fetch async await error handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function fetchWithAsyncAwait (id) { | |
try { | |
let response = await fetch(endpoint + id) | |
response = await response.json() | |
console.log(response) | |
} catch (error) { | |
console.log('opps' + error) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment