Skip to content

Commit

Permalink
code cleanup following review
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeauchamp committed Jan 12, 2022
1 parent 6b706cc commit c7a2901
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions @xen-orchestra/backups/_cleanVm.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ async function checkAliases(aliasPaths, targetDataRepository, { handler, onLog =

try {
const { dispose } = await openVhd(handler, target)
dispose()
} catch (e) {
onLog(`target ${target} of alias ${path} is missing or broken`)
await dispose()
} catch (error) {
onLog(`target ${target} of alias ${path} is missing or broken`, { error })
if (remove) {
try {
await VhdAbstract.unlink(handler, path)
} catch(e){}
} catch (e) {}
}
continue
}
Expand Down
4 changes: 1 addition & 3 deletions packages/vhd-lib/Vhd/VhdDirectory.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ exports.VhdDirectory = class VhdDirectory extends VhdAbstract {
bufHeader = (await this._readChunk('header')).buffer
bufFooter = (await this._readChunk('footer')).buffer
} catch (error) {
// to keep as much as possible of the vhdFile way of handlong broken vhd
// let's emit an assertion error (the vhd is broken, you should try to delete it)
// instead of a file not found error (the vhd is missing)
// emit an AssertionError if the VHD is broken to stay as close as possible to the VhdFile API
if (error.code === 'ENOENT') {
assert(false, 'Header And Footer should exists')
} else {
Expand Down

0 comments on commit c7a2901

Please sign in to comment.