From 0d2df3048acb5c414ad8abeccb65c86d899166b3 Mon Sep 17 00:00:00 2001 From: Daniel Kral Date: Tue, 15 Apr 2025 09:11:21 +0200 Subject: [PATCH] api: smart: return unknown health instead of error message In case of an error, the WebGUI expects the SMART data API endpoint to return a health value, but it will return an error message directly. To make this more user friendly, mask the error in the API handler. Signed-off-by: Daniel Kral Link: https://lore.proxmox.com/20250415071123.36921-1-d.kral@proxmox.com --- src/PVE/API2/Disks.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PVE/API2/Disks.pm b/src/PVE/API2/Disks.pm index 3f8b196..e707a9e 100644 --- a/src/PVE/API2/Disks.pm +++ b/src/PVE/API2/Disks.pm @@ -216,7 +216,7 @@ __PACKAGE__->register_method({ my $disk = PVE::Diskmanage::verify_blockdev_path($param->{disk}); - my $result = PVE::Diskmanage::get_smart_data($disk, $param->{healthonly}); + my $result = eval { PVE::Diskmanage::get_smart_data($disk, $param->{healthonly}) }; $result->{health} = 'UNKNOWN' if !defined $result->{health}; $result = { health => $result->{health} } if $param->{healthonly};