From 49be2bc1ae7ff53b35aeefc0dd60ffa8768b5184 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 19 Nov 2025 12:34:24 +0000 Subject: [PATCH] Remove usage of error --- prometheus.scm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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))