remove try/catch
This commit is contained in:
@@ -39,7 +39,6 @@ const apps = require('./apps.js'),
|
||||
dns = require('./dns.js'),
|
||||
dockerProxy = require('./dockerproxy.js'),
|
||||
eventlog = require('./eventlog.js'),
|
||||
execSync = require('child_process').execSync,
|
||||
fs = require('fs'),
|
||||
logs = require('./logs.js'),
|
||||
mail = require('./mail.js'),
|
||||
@@ -337,21 +336,13 @@ async function updateDiskUsage() {
|
||||
}
|
||||
|
||||
async function getBlockDevices() {
|
||||
let info;
|
||||
const info = safe.JSON.parse(safe.child_process.execSync('lsblk --paths --json --list --fs', { encoding: 'utf8' }));
|
||||
if (!info) throw new BoxError(BoxError.INTERNAL_ERROR, safe.error.message);
|
||||
|
||||
try {
|
||||
info = JSON.parse(execSync('lsblk --paths --json --list --fs', { encoding: 'utf8' }));
|
||||
} catch (e) {
|
||||
debug('Failed to list disks:', e);
|
||||
throw new BoxError(BoxError.INTERNAL_ERROR, e);
|
||||
}
|
||||
|
||||
// filter only for ext4 and xfs disks
|
||||
const devices = info.blockdevices.filter(d => d.fstype === 'ext4' || d.fstype === 'xfs');
|
||||
|
||||
debug(`getBlockDevices: Found ${devices.length} devices. ${devices.map(d => d.name).join(', ')}`);
|
||||
|
||||
// convert to fixed format
|
||||
return devices.map(function (d) {
|
||||
return {
|
||||
path: d.name,
|
||||
|
||||
Reference in New Issue
Block a user