From fe5b482b478261d32870a3a7e2cdb7ef0e78f67b Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 3 Sep 2024 18:12:56 +0100 Subject: 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. --- ravanan/command-line-tool.scm | 14 ++++++++------ 1 file 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 . (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) -- cgit v1.2.3