diff options
author | Arun Isaac | 2022-03-14 14:21:17 +0530 |
---|---|---|
committer | Arun Isaac | 2022-03-14 14:21:17 +0530 |
commit | 17d101b2f97edc8574528d5f05dd952921b67027 (patch) | |
tree | 42f5cd9c8c933cdf3c77f42e17e542223edbb13f /bin | |
parent | 015eab3dd8a55c29e463608b29a00e4e449036ec (diff) | |
download | tissue-17d101b2f97edc8574528d5f05dd952921b67027.tar.gz tissue-17d101b2f97edc8574528d5f05dd952921b67027.tar.lz tissue-17d101b2f97edc8574528d5f05dd952921b67027.zip |
bin: Handle message conditions.
* bin/tissue: Import (rnrs exceptions).
(main): Handle message conditions by printing them and exiting with
failure.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/tissue | 27 |
1 files changed, 16 insertions, 11 deletions
@@ -20,6 +20,7 @@ ;;; along with tissue. If not, see <https://www.gnu.org/licenses/>. (import (rnrs conditions) + (rnrs exceptions) (rnrs io ports) (srfi srfi-1) (srfi srfi-26) @@ -368,17 +369,21 @@ To get usage information for one of these sub-commands, run ((_ (or "-h" "--help")) (print-usage)) ((_ command args ...) - (apply (match command - ("news" tissue-news) - ("list" tissue-list) - ("edit" tissue-edit) - ("show" tissue-show) - (invalid-command - (format (current-error-port) "Invalid command `~a'~%~%" - invalid-command) - (print-usage) - (exit #f))) - args)) + (guard (c ((message-condition? c) + (display (condition-message c) (current-error-port)) + (newline (current-error-port)) + (exit #f))) + (apply (match command + ("news" tissue-news) + ("list" tissue-list) + ("edit" tissue-edit) + ("show" tissue-show) + (invalid-command + (format (current-error-port) "Invalid command `~a'~%~%" + invalid-command) + (print-usage) + (exit #f))) + args))) ;; tissue is an alias for `tissue list' ((_) (tissue-list)))) |