fix: more helpful error message when backup fails for nonexistent instance

This commit is contained in:
Ben Allfree 2022-11-20 03:51:53 -08:00
parent dd33c7dce6
commit 3b227ac31f

View File

@ -88,9 +88,16 @@ export const createBackupService = async (
status: BackupStatus.FinishedSuccess,
})
} catch (e) {
const message = (() => {
const s = `${e}`
if (s.match(/ENOENT/)) {
return `Backup failed because instance has never been used. Go to the instance admin to use the instance for the first time.`
}
return s
})()
await client.updateBackup(backupRec.id, {
status: BackupStatus.FinishedError,
message: `${e}`,
message,
})
}
return true