branch: externals/llm
commit eba797b295d320b3158fa4a491bbcf292417d0ac
Author: Andrew Hyatt <[email protected]>
Commit: Andrew Hyatt <[email protected]>
Implement error handling for gcloud auth issues
---
llm-vertex.el | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/llm-vertex.el b/llm-vertex.el
index 6c14f45cd0..6bcc949079 100644
--- a/llm-vertex.el
+++ b/llm-vertex.el
@@ -63,9 +63,10 @@ KEY-GENTIME keeps track of when the key was generated,
because the key must be r
(unless (and (llm-vertex-key provider)
(> (* 60 60)
(float-time (time-subtract (current-time) (or
(llm-vertex-key-gentime provider) 0)))))
- (setf (llm-vertex-key provider)
- (string-trim
- (shell-command-to-string (concat llm-vertex-gcloud-binary " auth
print-access-token"))))
+ (let ((result (string-trim (shell-command-to-string (concat
llm-vertex-gcloud-binary " auth print-access-token")))))
+ (when (string-match-p "ERROR" result)
+ (error "Could not refresh gcloud access token, received the following
error: %s" result))
+ (setf (llm-vertex-key provider) result))
(setf (llm-vertex-key-gentime provider) (current-time))))
(cl-defmethod llm-embedding ((provider llm-vertex) string)