discover/grub2: Improve error handling