Do some error handling whenever curl fails
This commit is contained in:
parent
8df4b24238
commit
0105a07695
1 changed files with 6 additions and 1 deletions
7
kagi.el
7
kagi.el
|
@ -151,7 +151,12 @@ PROMPT is used to fill in the POST part of the request."
|
||||||
(let ((command (kagi--build-curl-command prompt)))
|
(let ((command (kagi--build-curl-command prompt)))
|
||||||
(if kagi-debug
|
(if kagi-debug
|
||||||
kagi--canned-response
|
kagi--canned-response
|
||||||
(shell-command-to-string command))))
|
|
||||||
|
(with-temp-buffer
|
||||||
|
(let ((return (call-process-shell-command command nil t)))
|
||||||
|
(if (eql return 0)
|
||||||
|
(buffer-string)
|
||||||
|
(error "Call to FastGPT API returned with status %s" return)))))))
|
||||||
|
|
||||||
(defun kagi--process-prompt (prompt)
|
(defun kagi--process-prompt (prompt)
|
||||||
"Submit a PROMPT to FastGPT and process the API response.
|
"Submit a PROMPT to FastGPT and process the API response.
|
||||||
|
|
Loading…
Reference in a new issue