Function: ghub--read-json-payload

ghub--read-json-payload is a byte-compiled function defined in ghub.el.

Signature

(ghub--read-json-payload STATUS &optional JSON-TYPE-ARGS)

Source Code

;; Defined in ~/.emacs.d/elpa/ghub-20260401.1239/ghub.el
(defun ghub--read-json-payload (_status &optional json-type-args)
  (and-let* ((payload (ghub--decode-payload)))
    (progn
      (ghub--assert-json-available)
      (condition-case nil
          (apply #'json-parse-string payload
                 (or json-type-args
                     '( :object-type alist
                        :array-type list
                        :null-object nil
                        :false-object nil)))
        (json-parse-error
         (when ghub-debug
           (pop-to-buffer (current-buffer)))
         (setq-local ghub-debug t)
         `((message . ,(if (looking-at "<!DOCTYPE html>")
                           (if (re-search-forward
                                "<p>\\(?:<strong>\\)?\\([^<]+\\)" nil t)
                               (match-string 1)
                             "error description missing")
                         (string-trim (buffer-substring (point) (point-max)))))
           (documentation_url
            . "https://github.com/magit/ghub/wiki/Github-Errors")))))))