aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-01-16 13:14:49 +0530
committerArun Isaac2022-01-16 13:17:36 +0530
commitb2e3a9fd8b3c0c2a76684a78aaff80a759641120 (patch)
treefc904d977c5c589441af6ce0ebc6cb4942de0acb
parent050c8d3325263a405646ee2cee0b021880d1f290 (diff)
downloadccwl-b2e3a9fd8b3c0c2a76684a78aaff80a759641120.tar.gz
ccwl-b2e3a9fd8b3c0c2a76684a78aaff80a759641120.tar.lz
ccwl-b2e3a9fd8b3c0c2a76684a78aaff80a759641120.zip
ccwl: Raise parameter errors in workflow steps as exceptions.
* ccwl/ccwl.scm (collect-steps): Raise parameter errors in workflow steps as exceptions.
-rw-r--r--ccwl/ccwl.scm47
1 files changed, 27 insertions, 20 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm
index 32022d7..f31e99a 100644
--- a/ccwl/ccwl.scm
+++ b/ccwl/ccwl.scm
@@ -479,30 +479,37 @@ represented by <step> objects."
(syntax->datum (pairify #'(args ...)))))
(() #t)
(missing-parameters
- (scm-error 'misc-error
- #f
- "Step `~S' missing required parameters `~S'"
- (list step-id missing-parameters)
- #f)))
+ (raise-exception
+ ;; TODO: Report entire form, not just the name of the
+ ;; step.
+ (condition (ccwl-violation #'function)
+ (formatted-message "Step ~a missing required parameters ~a"
+ step-id
+ (map symbol->keyword missing-parameters))))))
;; Test for unknown keys.
(for-each (match-lambda
((arg . value)
- (unless (memq (keyword->symbol arg)
+ (unless (memq (keyword->symbol (syntax->datum arg))
(function-input-keys function-object))
- (scm-error 'misc-error
- #f
- "ccwl command `~S' does not accept input key `~S'. Accepted keys are `~S'."
- (list (syntax->datum #'ccwl-function)
- arg
- (function-input-keys function-object))
- #f))
- (unless (memq value input-key-symbols)
- (scm-error 'misc-error
- #f
- "ccwl step `~S' supplied with unknown key `~S'. Known keys at this step are `~S'."
- (list step-id value input-key-symbols)
- #f))))
- (syntax->datum (pairify #'(args ...))))
+ (raise-exception
+ ;; TODO: Report arg and value, not just arg.
+ (condition (ccwl-violation arg)
+ ;; TODO: Do not report accepted keys
+ ;; that have already been satisfied.
+ (formatted-message "Step ~a does not accept input key ~a. Accepted keys are ~a."
+ step-id
+ (syntax->datum arg)
+ (map symbol->keyword
+ (function-input-keys function-object))))))
+ (unless (memq (syntax->datum value)
+ input-key-symbols)
+ (raise-exception
+ (condition (ccwl-violation value)
+ (formatted-message "Step ~a supplied with unknown key ~a. Known keys at this step are ~a."
+ step-id
+ (syntax->datum value)
+ input-key-symbols))))))
+ (pairify #'(args ...)))
(values (append (remove key-step input-keys)
(map (lambda (output)
(key (output-id output) step-id))