diff --git a/prometheus.scm b/prometheus.scm index d6caa6a..f6e4c23 100644 --- a/prometheus.scm +++ b/prometheus.scm @@ -291,10 +291,13 @@ To specify values for the labels, pass an alist as values are the values." (unless (memq (metric-type metric) '(counter gauge)) - (error "can only increment counter and gauge metrics")) + (raise-exception + (make-exception-with-message + "can only increment counter and gauge metrics"))) (unless (positive? by) - (error "can only increment positive values")) + (raise-exception + (make-exception-with-message "can only increment positive values"))) (let ((canonical-labels (canonicalise-label-values label-values)) @@ -322,7 +325,8 @@ To specify values for the labels, pass an alist as values are the values." (unless (memq (metric-type metric) '(gauge)) - (error "can only increment gauge metrics")) + (raise-exception + (make-exception-with-message "can only increment gauge metrics"))) (let ((canonical-labels (canonicalise-label-values label-values)) @@ -348,7 +352,8 @@ To specify values for the labels, pass an alist as values are the values." (unless (memq (metric-type metric) '(gauge)) - (error "can only set gauge metrics")) + (raise-exception + (make-exception-with-message "can only set gauge metrics"))) (unless (number? value) (raise-exception @@ -374,7 +379,9 @@ To specify values for the labels, pass an alist as values are the values." (unless (histogram-metric-type? (metric-type metric)) - (error "can only observe histogram metrics")) + (raise-exception + (make-exception-with-message + "can only observe histogram metrics"))) (let ((canonical-labels (canonicalise-label-values label-values))