Skip to content

Commit dfb6443

Browse files
committed
add common message/error prefix
1 parent 8e8ed3e commit dfb6443

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
- In general, base your implementations and designs off of the Magit package. Its implementation can
1212
be found on GitHub.
1313
- Use stdlib Emacs packages, functions, and interfaces wherever possible.
14+
- All messages intended for display to the user should be prefixed with `[kele]` followed by a space

kele.el

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ If WAIT is non-nil, `kele--proxy-process' will wait for the proxy
238238
:sentinel
239239
(lambda (proc _status)
240240
(when (zerop (process-exit-status proc))
241-
(message "Successfully terminated process: %s" proc-name)
241+
(message "[kele] Successfully terminated process: %s" proc-name)
242242
(kele--kill-process-quietly proc)))))
243243
(ready-addr (format "http://localhost:%s/readyz" s-port))
244244
(live-addr (format "http://localhost:%s/livez" s-port)))
@@ -829,7 +829,7 @@ to complete. Returned value may not be up to date."
829829
(if-let* ((context (-first (lambda (elem) (string= (alist-get 'name elem) context-name))
830830
(alist-get 'contexts (oref kele--global-kubeconfig-cache contents)))))
831831
(alist-get 'cluster (alist-get 'context context))
832-
(error "Could not find context of name %s" context-name)))
832+
(error "[kele] Could not find context of name %s" context-name)))
833833

834834
(defun kele--context-annotate (context-name)
835835
"Return annotation text for the context named CONTEXT-NAME."
@@ -1042,7 +1042,7 @@ node `(elisp)Programmed Completion'."
10421042
(proxy-active-p kele--global-proxy-manager ctx))
10431043
(kele-context-names))))
10441044
(if (null contexts-with-proxy)
1045-
(user-error "No active proxy servers to stop")
1045+
(user-error "[kele] No active proxy servers to stop")
10461046
(list (completing-read "Stop proxy for context: " #'kele--contexts-with-active-proxy-complete)))))
10471047
(proxy-stop kele--global-proxy-manager context))
10481048

@@ -1223,7 +1223,7 @@ throws an error."
12231223
(car group-versions)
12241224
(oref gvk kind)
12251225
:context context)))
1226-
(user-error "Namespace `%s' specified for un-namespaced resource `%s'; remove namespace and try again" namespace (oref gvk kind)))
1226+
(user-error "[kele] Namespace `%s' specified for un-namespaced resource `%s'; remove namespace and try again" namespace (oref gvk kind)))
12271227

12281228
(-let* ((gv (car group-versions))
12291229
(namespace (and (kele--resource-namespaced-p
@@ -1362,7 +1362,7 @@ If CONTEXT is not provided, use the current context."
13621362
kele--global-discovery-cache
13631363
(kele--gv-string gvk)
13641364
(oref gvk kind))))
1365-
(user-error "Attempted to fetch un-namespaced resource `%s' as namespaced"
1365+
(user-error "[kele] Attempted to fetch un-namespaced resource `%s' as namespaced"
13661366
(oref gvk kind)))
13671367

13681368
(let* ((ctx (or context (kele-current-context-name)))
@@ -1539,10 +1539,10 @@ Ensures various preconditions are met,
15391539
e.g. `kele-kubectl-executable' is actually present."
15401540

15411541
(when (not (executable-find kele-kubectl-executable))
1542-
(error "`%s' not found on PATH" kele-kubectl-executable))
1542+
(error "[kele] `%s' not found on PATH" kele-kubectl-executable))
15431543

15441544
(when (not (file-exists-p kele-kubeconfig-path))
1545-
(error "`%s' does not exist; set up kubectl properly and try again" kele-kubeconfig-path)))
1545+
(error "[kele] `%s' does not exist; set up kubectl properly and try again" kele-kubeconfig-path)))
15461546

15471547
(defun kele--enable ()
15481548
"Enables Kele functionality.
@@ -1619,7 +1619,7 @@ Assumes that the current Transient prefix's :scope is an alist w/ `context' key.
16191619
:prompt prompt
16201620
:initial-input initial-input
16211621
:history history)
1622-
(error "Unexpected nil context in `%s'" (oref transient--prefix command))))
1622+
(error "[kele] Unexpected nil context in `%s'" (oref transient--prefix command))))
16231623

16241624
(defclass kele--transient-scope-mutator (transient-option)
16251625
((fn
@@ -2240,7 +2240,7 @@ instead of \"pod.\""
22402240
,name)
22412241
:silent nil
22422242
:suppress-error nil)
2243-
(message "Aborted deletion.")))
2243+
(message "[kele] Aborted deletion.")))
22442244

22452245
(transient-define-suffix kele-get (context namespace gvk name)
22462246
"Get resource GVK by NAME and display it in a buffer.
@@ -2360,9 +2360,9 @@ NAMESPACE and CONTEXT are used to identify the resource type to query for."
23602360
(lambda (proc _status)
23612361
(let ((exit-code (process-exit-status proc)))
23622362
(cl-case exit-code
2363-
(0 (message "Successfully terminated port-forward for %s" name))
2364-
(9 (message "Port-forward for %s (port %s) terminated" name port))
2365-
(t (message "Port-forward process for %s failed with exit code %s" name exit-code)))
2363+
(0 (message "[kele] Successfully terminated port-forward for %s" name))
2364+
(9 (message "[kele] Port-forward for %s (port %s) terminated" name port))
2365+
(t (message "[kele] Port-forward process for %s failed with exit code %s" name exit-code)))
23662366
(kele--kill-process-quietly proc)))
23672367
:noquery t)))
23682368
(add-to-list 'kele--active-port-forwards (list port context namespace gvk name proc))
@@ -2487,7 +2487,7 @@ The port-forward must have been initiated with
24872487
(proc (car (last record))))
24882488
(setq kele--active-port-forwards (assoc-delete-all port kele--active-port-forwards #'equal))
24892489
(kele--kill-process-quietly proc)
2490-
(message "Killed port-forward for port %s" port)))
2490+
(message "[kele] Killed port-forward for port %s" port)))
24912491

24922492
(transient-define-suffix kele-deployment-restart (context namespace deployment-name)
24932493
"Restart DEPLOYMENT-NAME.

0 commit comments

Comments
 (0)