diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-03-17 22:14:18 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-03-28 14:17:01 +0200 |
commit | 1da5a277188a954d881316cb605962ee66053285 (patch) | |
tree | 4f77be46498f321d08bfaa072636e4fd252b4f9d /module/calp/util/config.scm | |
parent | Unsmarted define-config% (diff) | |
download | calp-1da5a277188a954d881316cb605962ee66053285.tar.gz calp-1da5a277188a954d881316cb605962ee66053285.tar.xz |
Normalize errors.
Diffstat (limited to 'module/calp/util/config.scm')
-rw-r--r-- | module/calp/util/config.scm | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/module/calp/util/config.scm b/module/calp/util/config.scm index e1417d86..4862bbda 100644 --- a/module/calp/util/config.scm +++ b/module/calp/util/config.scm @@ -39,7 +39,11 @@ (for (key value) in (group kwargs 2) (aif (hashq-ref config-properties key) (set! (it name) value) - (error "Missing config protperty slot " key))) + (scm-error 'configuration-error + "define-config" + "No configuration slot named ~s, when defining ~s" + (list key name) + #f))) (set-config! name (get-config name default-value))) (define-syntax define-config @@ -52,7 +56,12 @@ (define-public (set-config! name value) (hashq-set! config-values name (aif (pre name) - (or (it value) (error "Pre crashed for" name)) + (or (it value) + (scm-error 'configuration-error + "set-config!" + "Pre-property failed when setting ~s to ~s" + (list name value) + #f)) value)) (awhen (post name) (it value))) @@ -63,8 +72,10 @@ (if (eq? default %uniq) (let ((v (hashq-ref config-values key %uniq))) (when (eq? v %uniq) - ;; TODO throw descript error - (error "Missing config" key)) + (scm-error 'configuration-error + "get-config" + "No configuration item named ~s" + (list key) #f)) v) (hashq-ref config-values key default))) |