fix error handling

This commit is contained in:
Girish Ramakrishnan
2021-05-14 14:46:16 -07:00
parent a56766ab0e
commit 24dbf53c5d
+3 -4
View File
@@ -126,8 +126,7 @@ async function writeMountFile(volume) {
}
const mountFileContents = ejs.render(SYSTEMD_MOUNT_EJS, { name, what, where: hostPath, options, type });
const [error] = await safe(shell.promises.sudo('generateMountFile', [ ADD_MOUNT_CMD, mountFileContents ], {}));
if (error) throw error;
await shell.promises.sudo('generateMountFile', [ ADD_MOUNT_CMD, mountFileContents ], {});
}
async function removeMountFile(volume) {
@@ -145,9 +144,9 @@ async function update(volume, mountType, mountOptions) {
if (error) throw error;
if (mountType === 'noop') {
await safe(removeMountFile(Object.assign({}, volume, { mountType, mountOptions })));
await removeMountFile(Object.assign({}, volume, { mountType, mountOptions }));
} else {
await safe(writeMountFile(Object.assign({}, volume, { mountType, mountOptions })));
await writeMountFile(Object.assign({}, volume, { mountType, mountOptions }));
}
let result;