[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/plz c181fd1565 10/40: Tidy: Error handling in THEN func
From: |
ELPA Syncer |
Subject: |
[elpa] externals/plz c181fd1565 10/40: Tidy: Error handling in THEN function |
Date: |
Mon, 26 Jun 2023 06:59:32 -0400 (EDT) |
branch: externals/plz
commit c181fd1565726f755f47e9f285949ed9d060d39a
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Tidy: Error handling in THEN function
---
plz.el | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/plz.el b/plz.el
index c0cb93a3d7..639b5ea9a4 100644
--- a/plz.el
+++ b/plz.el
@@ -444,44 +444,43 @@ NOQUERY is passed to `make-process', which see."
(plz--narrow-to-body)
(when decode
(decode-coding-region (point) (point-max)
coding-system))
- (let ((string (buffer-string)))
- (unless string
- (error "STRING IS NIL?! STRING:%S" string))
- (funcall then string)))))
+ (funcall then (or (buffer-string)
+ (make-plz-error :message (format
"buffer-string is nil in buffer:%S" process-buffer)))))))
('buffer (lambda ()
(funcall then (current-buffer))))
('response (lambda ()
- (let ((response (plz--response :decode-p
decode)))
- (unless response
- (error "RESPONSE IS NIL?!
BUFFER-CONTENTS:%S" (buffer-string)))
- (funcall then response))))
+ (funcall then (or (plz--response :decode-p
decode)
+ (make-plz-error :message
(format "response is nil for buffer:%S buffer-string:%S"
+
process-buffer (buffer-string)))))))
('file (lambda ()
(set-buffer-multibyte nil)
(plz--narrow-to-body)
(let ((filename (make-temp-file "plz-")))
(condition-case err
- (write-region (point-min) (point-max)
filename)
+ (progn
+ (write-region (point-min) (point-max)
filename)
+ (funcall then filename))
;; In case of an error writing to the file,
delete the temp file
;; and signal the error. Ignore any errors
encountered while
;; deleting the file, which would obscure the
original error.
(error (ignore-errors
(delete-file filename))
- (signal (car err) (cdr err))))
- (funcall then filename))))
+ (funcall then (make-plz-error :message
(format "error while writing to file %S: %S" filename err))))))))
(`(file ,(and (pred stringp) filename))
(lambda ()
(set-buffer-multibyte nil)
(plz--narrow-to-body)
(condition-case err
- (write-region (point-min) (point-max) filename nil
nil nil 'excl)
+ (progn
+ (write-region (point-min) (point-max) filename
nil nil nil 'excl)
+ (funcall then filename))
;; Since we are creating the file, it seems sensible
to delete it in case of an
;; error while writing to it (e.g. a disk-full
error). And we ignore any errors
;; encountered while deleting the file, which would
obscure the original error.
(error (ignore-errors
(when (file-exists-p filename)
(delete-file filename)))
- (signal (car err) (cdr err))))
- (funcall then filename)))
+ (funcall then (make-plz-error :message (format
"error while writing to file %S: %S" filename err)))))))
((pred functionp) (lambda ()
(let ((coding-system (or
(plz--coding-system) 'utf-8)))
(plz--narrow-to-body)
- [elpa] externals/plz 880223e7c0 22/40: Tidy: (plz--sentinel), (continued)
- [elpa] externals/plz 880223e7c0 22/40: Tidy: (plz--sentinel), ELPA Syncer, 2023/06/26
- [elpa] externals/plz 53ef6a16ce 26/40: Comment: Tidy, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 582f0c5bb8 31/40: Tests: Enable continue-on-error for linting, ELPA Syncer, 2023/06/26
- [elpa] externals/plz b896c41d71 32/40: Change: Generate buffer for STDERR, ELPA Syncer, 2023/06/26
- [elpa] externals/plz d2a7368699 37/40: Tidy: (plz) Don't switch to process-buffer, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 9319470060 38/40: Merge branch 'wip/no-signal-from-sentinel-as-timer', ELPA Syncer, 2023/06/26
- [elpa] externals/plz 5e63662e21 40/40: Docs: Update changelog, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 0cb20bc74d 03/40: Tidy, ELPA Syncer, 2023/06/26
- [elpa] externals/plz e28b4e8b6a 06/40: Tidy, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 8f263bfd0f 09/40: Comment: Remove old TODO, ELPA Syncer, 2023/06/26
- [elpa] externals/plz c181fd1565 10/40: Tidy: Error handling in THEN function,
ELPA Syncer <=
- [elpa] externals/plz 4735c8333d 17/40: Fix: (plz) Signal error with data as list, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 260840d3e7 18/40: Change: (plz--respond) Rename from plz--timer, ELPA Syncer, 2023/06/26
- [elpa] externals/plz b04b466d79 19/40: Change: Signal plz-curl/http-error again, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 5a60113110 21/40: Comment: Add links to bug reports, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 96710ad323 23/40: Tidy, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 7edcd67472 27/40: Change: Set STDERR process and sentinel, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 3576b9820c 28/40: Tidy: Unused arguments, ELPA Syncer, 2023/06/26
- [elpa] externals/plz f94f8af98a 30/40: Tidy: Error message, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 1aad476df9 33/40: Fix: Replace string in error data, ELPA Syncer, 2023/06/26
- [elpa] externals/plz 3dfcbff613 36/40: Change: Use process properties instead of buffer-local variables, ELPA Syncer, 2023/06/26