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.
This commit is contained in:
Lucien Cartier-Tilet 2021-11-06 22:51:11 +01:00
parent 27ae353336
commit 41222b5f89
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -318,7 +318,7 @@ Return detected partitions as a list of structs. See
`eshell-info-banner-partition-prefixes' to see how partitions are `eshell-info-banner-partition-prefixes' to see how partitions are
chosen." chosen."
(progn (progn
(message "Partition detection for Windows and DOS not yet supported.") (warn "Partition detection for Windows and DOS not yet supported.")
nil)) nil))
(defun eshell-info-banner--get-mounted-partitions/darwin () (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)) (eshell-info-banner--get-mounted-partitions/darwin))
(other (other
(progn (progn
(message "Partition detection for %s not yet supported." other) (warn "Partition detection for %s not yet supported." other)
nil))))) nil)))))
(defun eshell-info-banner--partition-to-string (partition text-padding bar-length) (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 () (defun eshell-info-banner--get-memory/windows ()
"Get memory usage for Window." "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) nil)
(defun eshell-info-banner--get-memory () (defun eshell-info-banner--get-memory ()
@ -464,7 +464,7 @@ in bytes."
(eshell-info-banner--get-memory/darwin)) (eshell-info-banner--get-memory/darwin))
((or 'ms-dos 'windows-nt 'cygwin) ((or 'ms-dos 'windows-nt 'cygwin)
(eshell-info-banner--get-memory/windows)) (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))) nil)))
(defun eshell-info-banner--memory-to-string (type total used text-padding bar-length) (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) ((or 'gnu 'gnu/linux 'gnu/kfreebsd)
(eshell-info-banner--get-os-information/gnu)) (eshell-info-banner--get-os-information/gnu))
('darwin ('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"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;