Skip to content
Advertisement

Tag: asynchronous

When should I use try catch instead of then catch?

The question is simple, but I haven’t found the answer anywhere. When should i use try catch? in the code below I use try catch to handle the return of a request: Would it be a good practice to use then(…).catch(…)? Answer The difference is in how you’re handing Promises. If you’re using await to handle the Promise then you

Then Vs Await issue

You dont have to read the code, what is happening is a file is being uploaded 1000 bytes at a time. And to ensure that we send the bytes in order we are using await. What if I wanted to use .then(), it seems hard as there is a loop around the fetch call. Answer Here is the same functionality

Advertisement