summaryrefslogtreecommitdiffstats
path: root/stdout
diff options
context:
space:
mode:
authorDaniel Milde <daniel@milde.cz>2021-02-13 20:18:05 +0100
committerDaniel Milde <daniel@milde.cz>2021-02-13 20:18:05 +0100
commitf2cc515d40709a7a60da0dc94633476b204f319a (patch)
tree7e4b5cff8c707b6836fec15a754fc849bcd0661d /stdout
parenteafb176da59b2fce00487255a3764d68fdbec025 (diff)
do not panic, bubble errors to the top
Diffstat (limited to 'stdout')
-rw-r--r--stdout/stdout.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/stdout/stdout.go b/stdout/stdout.go
index 8776750..cf4edaf 100644
--- a/stdout/stdout.go
+++ b/stdout/stdout.go
@@ -47,10 +47,10 @@ func CreateStdoutUI(output io.Writer, useColors bool, showProgress bool, showApp
}
// ListDevices lists mounted devices and shows their disk usage
-func (ui *UI) ListDevices(getter device.DevicesInfoGetter) {
+func (ui *UI) ListDevices(getter device.DevicesInfoGetter) error {
devices, err := getter.GetDevicesInfo()
if err != nil {
- panic(err)
+ return err
}
maxDeviceNameLenght := maxInt(maxLength(
@@ -100,6 +100,8 @@ func (ui *UI) ListDevices(getter device.DevicesInfoGetter) {
ui.red.Sprintf("%.f%%", usedPercent),
device.MountPoint)
}
+
+ return nil
}
// AnalyzePath analyzes recursively disk usage in given path