fix(emacs): improve rbw password error handling
Show clear error message when rbw entry not found instead of embedding error text in URLs/credentials.
This commit is contained in:
@@ -187,10 +187,13 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
(defun my/get-rbw-password (alias)
|
(defun my/get-rbw-password (alias)
|
||||||
"Return the password for ALIAS via rbw, unlocking the vault only if needed."
|
"Return the password for ALIAS via rbw, unlocking the vault only if needed.
|
||||||
(let* ((cmd (format "rbw get %s 2>&1" alias))
|
Returns nil and signals an error if the entry is not found."
|
||||||
(output (shell-command-to-string cmd)))
|
(let* ((cmd (format "rbw get %s 2>/dev/null" (shell-quote-argument alias)))
|
||||||
(string-trim output)))
|
(output (string-trim (shell-command-to-string cmd))))
|
||||||
|
(if (string-empty-p output)
|
||||||
|
(user-error "rbw: no entry found for '%s' - run: rbw add %s" alias alias)
|
||||||
|
output)))
|
||||||
|
|
||||||
(after! gptel
|
(after! gptel
|
||||||
:config
|
:config
|
||||||
|
|||||||
Reference in New Issue
Block a user