[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/plz 0d4356640d 05/40: Change: Use only one error type,
From: |
ELPA Syncer |
Subject: |
[elpa] externals/plz 0d4356640d 05/40: Change: Use only one error type, plz-error |
Date: |
Mon, 26 Jun 2023 06:59:31 -0400 (EDT) |
branch: externals/plz
commit 0d4356640d8c600b11247497071f9b6fd3715471
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Change: Use only one error type, plz-error
---
plz.el | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/plz.el b/plz.el
index 48c446bb97..2b24156f0a 100644
--- a/plz.el
+++ b/plz.el
@@ -327,10 +327,9 @@ request, in which case the result is returned directly.
ELSE is an optional callback function called when the request
fails (i.e. if curl fails, or if the HTTP response has a non-2xx
status code). It is called with one argument, a `plz-error'
-structure. If ELSE is nil, an error is signaled when the request
-fails, either `plz-curl-error' or `plz-http-error' as
-appropriate, with a `plz-error' structure as the error data. For
-synchronous requests, this argument is ignored.
+structure. If ELSE is nil, a `plz-error' is signaled when the
+request fails, with a `plz-error' structure as the error data.
+For synchronous requests, this argument is ignored.
NOTE: In v0.8 of plz, only one error will be signaled:
`plz-error'. The existing errors, `plz-curl-error' and
@@ -428,10 +427,10 @@ NOQUERY is passed to `make-process', which see."
(get-buffer-process stderr-buffer) #'ignore)
(when (eq 'sync then)
(setf sync-p t
- ;; FIXME: For sync requests, `else' should be forced nil.
then (lambda (result)
(process-put process :plz-result result)
- (setf plz-result result))))
+ (setf plz-result result))
+ else nil))
(with-current-buffer process-buffer
(let ((then (pcase-exhaustive as
((or 'binary 'string)
@@ -517,7 +516,7 @@ NOQUERY is passed to `make-process', which see."
;; FIXME: ...signal correct error type
(if plz-else
(funcall plz-else (process-get process :plz-result))
- (signal 'plz-http-error (process-get process
:plz-result))))
+ (signal 'plz-error (process-get process :plz-result))))
(_
(process-get process :plz-result))))
(unless (eq as 'buffer)
@@ -796,7 +795,7 @@ node `(elisp) Sentinels'). Kills the buffer before
returning."
;; Skip proxy headers (curl apparently offers no way to omit
;; them).
(unless (re-search-forward "\r\n\r\n" nil t)
- (signal 'plz-http-error '("plz--response: End of proxy headers not
found")))))))
+ (signal 'plz-error '("plz--response: End of proxy headers not
found")))))))
(defun plz--skip-redirect-headers ()
"Skip HTTP redirect headers in current buffer."
@@ -805,7 +804,7 @@ node `(elisp) Sentinels'). Kills the buffer before
returning."
;; Skip redirect headers ("--dump-header" forces redirect headers to be
included
;; even when used with "--location").
(or (re-search-forward "\r\n\r\n" nil t)
- (signal 'plz-http-error '("plz--response: End of redirect headers not
found")))))
+ (signal 'plz-error '("plz--response: End of redirect headers not
found")))))
(cl-defun plz--response (&key (decode-p t))
"Return response structure for HTTP response in current buffer.
@@ -816,7 +815,7 @@ Assumes that point is at beginning of HTTP response."
(save-excursion
;; Parse HTTP version and status code.
(unless (looking-at plz-http-response-status-line-regexp)
- (signal 'plz-http-error
+ (signal 'plz-error
(list "plz--response: Unable to parse HTTP response status line"
(buffer-substring (point) (line-end-position)))))
(let* ((http-version (string-to-number (match-string 1)))
@@ -869,7 +868,7 @@ Assumes point is at start of HTTP response."
"Narrow to body of HTTP response in current buffer.
Assumes point is at start of HTTP response."
(unless (re-search-forward plz-http-end-of-headers-regexp nil t)
- (signal 'plz-http-error '("plz--narrow-to-body: Unable to find end of
headers")))
+ (signal 'plz-error '("plz--narrow-to-body: Unable to find end of
headers")))
(narrow-to-region (point) (point-max)))
;;;; Footer
- [elpa] externals/plz updated (a8ae654530 -> 5e63662e21), ELPA Syncer, 2023/06/26
- [elpa] externals/plz 9ac623858c 01/40: WIP: Fix nil return value bugs, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 797963c035 02/40: WIP: Use separate buffer for STDERR, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 50d977288e 04/40: Fix: Set stderr process sentinel to #'ignore, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 0d4356640d 05/40: Change: Use only one error type, plz-error,
ELPA Syncer <=
- [elpa] externals/plz 046f29a816 08/40: Docs: Remove old TODO, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 81d1c61f1f 07/40: Tidy docstring and comment, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 56c92ff78e 12/40: Tidy, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 43231ac43c 14/40: WIP: Use timer for response parsing, ELPA Syncer, 2023/06/26
- [elpa] externals/plz d6dfe3b27a 11/40: Tidy: Remove plz-result, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 85ac0fbe38 15/40: WIP: Use sentinel value; add comments, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 7d197e968a 20/40: Change: (plz--respond) Don't catch errors from THEN/ELSE, ELPA Syncer, 2023/06/26
- [elpa] externals/plz a2c20b1437 24/40: Comment: TODO, ELPA Syncer, 2023/06/26
- [elpa] externals/plz f551c1bd49 25/40: Tidy: (plz--respond), ELPA Syncer, 2023/06/26
- [elpa] externals/plz de8e21f81d 29/40: Tidy: Docstrings, ELPA Syncer, 2023/06/26