diff options
author | Arun Isaac | 2023-09-28 23:50:05 +0100 |
---|---|---|
committer | Arun Isaac | 2023-09-28 23:51:21 +0100 |
commit | d58e5585b62bd284a7e27045e748c2cf1d31a649 (patch) | |
tree | 9c2251a076ec2ea2c2cf6b2b89d1bfcd32a2b768 | |
parent | efc929b3f65595255f57f069769a60a4544b9c72 (diff) | |
download | ccwl-d58e5585b62bd284a7e27045e748c2cf1d31a649.tar.gz ccwl-d58e5585b62bd284a7e27045e748c2cf1d31a649.tar.lz ccwl-d58e5585b62bd284a7e27045e748c2cf1d31a649.zip |
scripts: Raise exception when file does not return supported object.
* scripts/ccwl (main): Raise exception when file returns neither
workflow nor command.
-rwxr-xr-x | scripts/ccwl | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/ccwl b/scripts/ccwl index fe8d114..b3762c5 100755 --- a/scripts/ccwl +++ b/scripts/ccwl @@ -26,7 +26,8 @@ exec guile --no-auto-compile -e main -s "$0" "$@" ;;; Code: -(use-modules (rnrs exceptions) +(use-modules (rnrs conditions) + (rnrs exceptions) (srfi srfi-28) (srfi srfi-37) (ice-9 match) @@ -119,8 +120,14 @@ Compile SOURCE-FILE. ((ccwl-violation? exception) (report-ccwl-violation exception) (exit #f))) - (load (canonicalize-path (assq-ref args 'source-file)) - read-syntax)) + (let ((result (load (canonicalize-path (assq-ref args 'source-file)) + read-syntax))) + (if (or (command? result) + (workflow? result)) + result + (raise-exception + (condition (formatted-message "Last expression in file ~a returns neither workflow nor command" + (assq-ref args 'source-file))))))) (current-output-port))))) ((program args ...) (let ((args (args-fold args |