I have the following code:
var execute = async (assets: DCXComposite[], session: Session) => {
return await session.performBatchOperation();
};
try {
var assets: Composite[] = [];
for (const project of projects) {
assets.push(project.getComposite());
if (assets.length === 50) {
var result = execute(assets);
assets = [];
}
}
} catch (err) {
Logger.error('Unable to batch delete projects', { error: err });
}
Is this how to use async/await? If one of the executes fails, does the whole code fail and get thrown into the catch block? Meaning the next 50 projects do not get executed? What happens when the await throws an error?