07 How to handle error in API call with await keyword | Promise Advanced JS Simplified

preview_player
Показать описание
How to handle error in API call with await keyword | Promise Advanced JS Simplified
@ApplyIT2021 #asyncawait #javascript #advancejavascript
While making an API call, with the use of then() and catch() callbacks, we get error response in catch() callback. In the same way, if we make an API call using await keyword, we should have some way to get error response. This video demonstrates how can we handle error by wrapping the call with await in try-catch block. It also demonstrates practically, why calling multiple APIs in sequence with then() and catch() callbacks create nesting structure, which is difficult to understand. It explains that using await keyword, we can simplify code that requires passing response of one API call as input to another API call.

This video answers many questions related to use of await:
What is the use of await keyword in JavaScript
Handle error while making call using await
Error handling with async await in JavaScript
Async await error handling
Error handling in async await with API calling
Error handling with async await and promises
async await in JavaScript
why we use async await in JavaScript
Mastering error handling with async await in JavaScript
Make code better with error handling using try-catch
Using try-catch with promises
Using try-catch with await
Why do we use await keyword in JavaScript
async await in JavaScript in depth
async await in JavaScript in English
async await promise
async await error handling

Playlist

Watch previous videos
01 Promise Advanced JS Simplified | Difference between Synchronous and Asynchronous Call Simplified

02 Promise Advanced JS Simplified | Understand What is Promise in Details

03 Promise Advanced JS Simplified | How to Create Promise Object

04 Use then and catch to get result of async operation | Promise Advanced JS Simplified

05 Convert async call into synchronous call using await | Promise Advanced JS Simplified

06 Why to use await to convert async call into synchronous | Promise Advanced JS Simplified
Рекомендации по теме
Комментарии
Автор

i am facing this error when using await like you have used
SyntaxError: await is only valid in async functions and the top level bodies of modules (at script.js:24:15)

codedwebs