summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2022-03-15 15:04:02 +0530
committerArun Isaac2022-03-15 15:04:02 +0530
commit05a792a120227f9ce294866dfd1494e059968335 (patch)
tree1332d55d47b03043893c62a6b4b7110e2b18dcda
parent496911486cf83dfab47dba96315544ac6484df22 (diff)
downloadtissue-05a792a120227f9ce294866dfd1494e059968335.tar.gz
tissue-05a792a120227f9ce294866dfd1494e059968335.tar.lz
tissue-05a792a120227f9ce294866dfd1494e059968335.zip
tissue: Use more specific &issue-file-not-found-error.
* bin/tissue: Do not import (rnrs conditions). Import (tissue
conditions).
(tissue-edit, tissue-show): Raise &issue-file-not-found-error instead
of &message-condition.
(print-usage): Handle &issue-file-not-found-error instead of
&message-condition.
* tissue/web.scm: Do not import (rnrs exceptions). Import (tissue
conditions).
(build-website): Raise &issue-file-not-found-error instead of
&message-condition.
-rwxr-xr-xbin/tissue16
-rw-r--r--tissue/web.scm5
2 files changed, 11 insertions, 10 deletions
diff --git a/bin/tissue b/bin/tissue
index e0abcda..e399e64 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -19,8 +19,7 @@
 ;;; You should have received a copy of the GNU General Public License
 ;;; along with tissue.  If not, see <https://www.gnu.org/licenses/>.
 
-(import (rnrs conditions)
-        (rnrs exceptions)
+(import (rnrs exceptions)
         (rnrs io ports)
         (srfi srfi-1)
         (srfi srfi-26)
@@ -30,6 +29,7 @@
         (ice-9 match)
         (ice-9 popen)
         (ice-9 regex)
+        (tissue conditions)
         (tissue issue)
         (tissue utils))
 
@@ -286,8 +286,7 @@ export EDITOR=emacsclient"))
        ;; committed. Therefore, only read the file if it exists.
        (if (file-exists? issue-file)
            (invoke (getenv "EDITOR") issue-file)
-           (raise (make-message-condition
-                   (string-append "No such file or directory: " issue-file))))))))
+           (raise (issue-file-not-found-error issue-file)))))))
 
 (define tissue-show
   (match-lambda*
@@ -344,8 +343,7 @@ Show the text of issue #ISSUE-NUMBER.
                 (const #t)
                 get-line-dos-or-unix
                 port)))
-           (raise (make-message-condition
-                   (string-append "No such file or directory: " issue-file))))))))
+           (raise (issue-file-not-found-error issue-file)))))))
 
 (define (print-usage)
   (format #t "Usage: ~a COMMAND [OPTIONS] [ARGS]
@@ -369,8 +367,10 @@ To get usage information for one of these sub-commands, run
     ((_ (or "-h" "--help"))
      (print-usage))
     ((_ command args ...)
-     (guard (c ((message-condition? c)
-                (display (condition-message c) (current-error-port))
+     (guard (c ((issue-file-not-found-error? c)
+                (display (string-append "No such file or directory: "
+                                        (issue-file-not-found-error-issue-file c))
+                         (current-error-port))
                 (newline (current-error-port))
                 (exit #f)))
        (apply (match command
diff --git a/tissue/web.scm b/tissue/web.scm
index 79568e6..92d33a6 100644
--- a/tissue/web.scm
+++ b/tissue/web.scm
@@ -17,6 +17,7 @@
 ;;; along with tissue.  If not, see <https://www.gnu.org/licenses/>.
 
 (define-module (tissue web)
+  #:use-module (rnrs exceptions)
   #:use-module (rnrs io ports)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
@@ -31,6 +32,7 @@
   #:use-module (skribilo utils keywords)
   #:use-module (skribilo writer)
   #:use-module (sxml simple)
+  #:use-module (tissue conditions)
   #:use-module (tissue issue)
   #:use-module (tissue utils)
   #:export (issue-listing
@@ -245,8 +247,7 @@ issue listings are not generated."
                                                                   'gemtext)
                                                                  ((string-suffix? ".skb" input-file)
                                                                   'skribe)))))))
-                                 (raise (make-message-condition
-                                         (string-append "No such file or directory: " input-file))))
+                                 (raise (issue-file-not-found-error input-file)))
                              (find-engine 'html)))
                       (copy-file input-file output-file))))))
       rcons get-line port))