I'm struggling with a loop of async await function. I'm creating an API which POST a request to another API. I have to make a loop because users could insert many items at once in the database.

The API that I call rejects Parallel executions so I can't use `Promise.all` :/

In order to implement that service I made a function to insert one object :

```
const addValue = async (ID:number, cookie: string) => {
    try {
        const addValueBody = await addValueQuery(ID:number)
        const header = { 'cookie': cookie, 'content-type': 'application/json' }
        const fetchResult = fetch('http://api-to-call.xyz', { method: `POST`, headers: header, body: addValueBody })
        const response = await fetchResult
        const jsonData = await response.json()
        return jsonData
     } catch (e) {
        throw Error(e.message)
    }
}

```

And a function which will execute `addValue` inside a for loop :

```
const addMulti = async (values: any, cookie: string) => {
    for (const item of values) {
           await addValue(item.ID, cookie)
    }
}

```

The problem is that when I call addMulti and if there is an Error I have a `UnhandledPromiseRejectionWarning`.

Also I tried to put de `for ... in` or `await addValue` inside a `try catch` but it doesn't catch the Error(s) 

Hence, I have 2 questions :

How can I throw en Error if it occurs during the execution of the loop ?
Is it possible to break the loop if there is an error ?

Thanks for your help :)