dimer47 / node-ovh-objectstorage

Creative Commons Attribution Share Alike 4.0 International
13 stars 11 forks source link

Throws in async function are not catched properly and result in unhandled rejections #30

Open Totalus opened 1 year ago

Totalus commented 1 year ago

https://github.com/dimer47/node-ovh-objectstorage/blob/c9b2dfabff8d0fff9148e8b1f247fa03765ba208/src/Containers.js#L298

This lines creates an async function at the wrong place. It causes all the throws statements within the block to not be properly catched, resulting in unhandled rejection exceptions that cannot be handled during execution.

The async statement should be placed at the promise function level instead:

https://github.com/dimer47/node-ovh-objectstorage/blob/c9b2dfabff8d0fff9148e8b1f247fa03765ba208/src/Containers.js#L296

Like its done in all the other places:

https://github.com/dimer47/node-ovh-objectstorage/blob/c9b2dfabff8d0fff9148e8b1f247fa03765ba208/src/Containers.js#L240