Function: ghub--handle-response
ghub--handle-response is a byte-compiled function defined in ghub.el.
Signature
(ghub--handle-response STATUS REQ)
Source Code
;; Defined in ~/.emacs.d/elpa/ghub-20260401.1239/ghub.el
(defun ghub--handle-response (status req)
(let ((buf (current-buffer)))
(unwind-protect
(progn
(set-buffer-multibyte t)
(let* ((unpaginate (ghub--req-unpaginate req))
(headers (ghub--handle-response-headers status req))
(payload (ghub--handle-response-payload req))
(payload (ghub--handle-response-error status payload req))
(value (ghub--handle-response-value payload req))
(prev (ghub--req-url req))
(next (cdr (assq 'next (ghub-response-link-relations
req headers payload)))))
(when (numberp unpaginate)
(cl-decf unpaginate))
(setf (ghub--req-url req)
(url-generic-parse-url next))
(setf (ghub--req-unpaginate req) unpaginate)
(or (and next
unpaginate
(or (eq unpaginate t)
(> unpaginate 0))
(ghub-continue req))
(let ((req-buf (ghub--req-buffer req))
(callback (ghub--req-callback req))
(errorback (ghub--req-errorback req))
(err (plist-get status :error)))
(cond ((and err errorback)
(setf (ghub--req-url req) prev)
(when (eq errorback t)
(setq errorback #'ghub--errorback))
(condition-case nil
(funcall errorback err headers status req)
(wrong-number-of-arguments
(funcall errorback err))))
(callback
(save-current-buffer
(when (buffer-live-p req-buf)
(set-buffer req-buf))
(condition-case nil
(funcall callback value headers status req)
(wrong-number-of-arguments
(funcall callback value)))))
(t value))))))
(when (and (buffer-live-p buf)
(not (buffer-local-value 'ghub-debug buf)))
(kill-buffer buf)))))