From 41222b5f895a338809bc1e3de820b771fcbde93b Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Sat, 6 Nov 2021 22:51:11 +0100 Subject: [PATCH] Add error handling in case of an unknown OS, warn instead of message Warn the user if something goes wrong instead of just a message in the minibuffer and the *Message* buffer. --- eshell-info-banner.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/eshell-info-banner.el b/eshell-info-banner.el index c4cfb97..f52ea09 100644 --- a/eshell-info-banner.el +++ b/eshell-info-banner.el @@ -318,7 +318,7 @@ Return detected partitions as a list of structs. See `eshell-info-banner-partition-prefixes' to see how partitions are chosen." (progn - (message "Partition detection for Windows and DOS not yet supported.") + (warn "Partition detection for Windows and DOS not yet supported.") nil)) (defun eshell-info-banner--get-mounted-partitions/darwin () @@ -363,7 +363,7 @@ Return detected partitions as a list of structs." (eshell-info-banner--get-mounted-partitions/darwin)) (other (progn - (message "Partition detection for %s not yet supported." other) + (warn "Partition detection for %s not yet supported." other) nil))))) (defun eshell-info-banner--partition-to-string (partition text-padding bar-length) @@ -444,7 +444,7 @@ For TEXT-PADDING and BAR-LENGTH, see the documentation of (defun eshell-info-banner--get-memory/windows () "Get memory usage for Window." - (message "Memory usage not yet implemented for Windows and DOS") + (warn "Memory usage not yet implemented for Windows and DOS") nil) (defun eshell-info-banner--get-memory () @@ -464,7 +464,7 @@ in bytes." (eshell-info-banner--get-memory/darwin)) ((or 'ms-dos 'windows-nt 'cygwin) (eshell-info-banner--get-memory/windows)) - (os (message "Memory usage not yet implemented for %s" os) + (os (warn "Memory usage not yet implemented for %s" os) nil))) (defun eshell-info-banner--memory-to-string (type total used text-padding bar-length) @@ -688,7 +688,9 @@ build number)." ((or 'gnu 'gnu/linux 'gnu/kfreebsd) (eshell-info-banner--get-os-information/gnu)) ('darwin - (eshell-info-banner--get-os-information/darwin)))) + (eshell-info-banner--get-os-information/darwin)) + (os (warn "Operating system information retrieving not yet supported for %s") + '((format "%s") . "Unknown")))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;