I didn't know that can use the 'catch' to an await function.
I've been used only try-catch block for catching errors. and I've just known that only works.
Thanks for your post :)
You can use catch on a promise and it will return another promise.
You can use await on a promise to wait for the result.
So everything is ok with the example, even if with the await keyword you can use a try/catch block to catch the error rejected by a promise.
I didn't know that can use the 'catch' to an await function.
I've been used only try-catch block for catching errors. and I've just known that only works.
Thanks for your post :)
Welcome!
You can use catch on a promise and it will return another promise.
You can use await on a promise to wait for the result.
So everything is ok with the example, even if with the await keyword you can use a try/catch block to catch the error rejected by a promise.
Thank you :DD