forked from kubernetes-el/kubernetes-el
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkubernetes-errors.el
More file actions
31 lines (25 loc) · 1.05 KB
/
kubernetes-errors.el
File metadata and controls
31 lines (25 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
;;; kubernetes-errors.el --- Rendering for Kubernetes errors -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(require 'dash)
(require 'subr-x)
(require 'kubernetes-state)
(defun kubernetes-errors-render (state)
(-when-let* (((&alist 'message message 'command command) (kubernetes-state--get state 'last-error))
(message-paragraph
(with-temp-buffer
(insert message)
(fill-region (point-min) (point-max))
(indent-region (point-min) (point-max) 2)
(string-trim-right (buffer-string)))))
`(section (error nil)
(heading (propertize (face font-lock-warning-face) "kubectl command failed"))
(padding)
(section (message nil)
(copy-prop ,message (line ,message-paragraph))
(padding))
(section (command nil)
(key-value 10 "Command" ,command)
(padding)))))
(provide 'kubernetes-errors)
;;; kubernetes-errors.el ends here