diff options
author | Arun Isaac | 2024-09-03 18:12:56 +0100 |
---|---|---|
committer | Arun Isaac | 2024-09-05 16:22:49 +0100 |
commit | fe5b482b478261d32870a3a7e2cdb7ef0e78f67b (patch) | |
tree | a4c0e8c38a680271274c1cbcd12f4c411635d799 | |
parent | d145134fb75635d7ae53630e93cb637536fde024 (diff) | |
download | ravanan-fe5b482b478261d32870a3a7e2cdb7ef0e78f67b.tar.gz ravanan-fe5b482b478261d32870a3a7e2cdb7ef0e78f67b.tar.lz ravanan-fe5b482b478261d32870a3a7e2cdb7ef0e78f67b.zip |
command-line-tool: Disambiguate error from raise-error.
error reports an error to the user. raise-error raises an exception and is meant
for programmers.
* ravanan/command-line-tool.scm: Import error from (rnrs base) as raise-error.
(build-command, collect-input-files, resolve-inputs,
build-command-line-tool-script): Use raise-error instead of error.
-rw-r--r-- | ravanan/command-line-tool.scm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm index 542e481..391ed81 100644 --- a/ravanan/command-line-tool.scm +++ b/ravanan/command-line-tool.scm @@ -17,7 +17,7 @@ ;;; along with ravanan. If not, see <https://www.gnu.org/licenses/>. (define-module (ravanan command-line-tool) - #:use-module ((rnrs base) #:select (assertion-violation)) + #:use-module ((rnrs base) #:select (assertion-violation (error . raise-error))) #:use-module ((rnrs conditions) #:select (define-condition-type)) #:use-module (rnrs exceptions) #:use-module (srfi srfi-1) @@ -233,7 +233,7 @@ G-expressions are inserted." (let* ((type (formal-parameter-type type-tree)) (matched-type (match-type input type))) (unless matched-type - (error "Type mismatch" input type)) + (raise-error input "Type mismatch" input type)) (let ((position (from-maybe (maybe-let* ((position (maybe-assoc-ref binding "position"))) @@ -329,7 +329,7 @@ basename of the original path, and not the store-interned path." (let* ((type (formal-parameter-type type-tree)) (matched-type (match-type input type))) (unless matched-type - (error "Type mismatch" input type)) + (raise-error input "Type mismatch" input type)) (cond ;; Recurse over array types. ;; TODO: Implement record and enum types. @@ -370,7 +370,7 @@ original path, and not the store-interned path." (let* ((type (formal-parameter-type type-tree)) (matched-type (match-type input type))) (unless matched-type - (error "Type mismatch" input type)) + (raise-error input "Type mismatch" input type)) ;; TODO: Implement record and enum types. (cond ;; Recurse over array types. @@ -731,7 +731,9 @@ named @var{name} with @var{inputs} using tools from Guix manifest 'null)) (matched-type (match-type output-value output-type))) (unless matched-type - (error "Type mismatch" output-value output-type)) + (raise-error output-value + "Type mismatch" + output-value output-type)) (case matched-type ((null) (list)) @@ -762,7 +764,7 @@ named @var{name} with @var{inputs} using tools from Guix manifest (from-maybe (maybe-assoc-ref (just output) "outputBinding" "glob") - (error "glob output binding not specified"))) + (raise-error #f "glob output binding not specified"))) other-outputs))))) out #:pretty #t) |