From 96047a6faac92416adba742c6fd55a3eb0df486e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 24 May 2020 22:28:59 +0200 Subject: Introduce warnings-are-errors parameter. --- module/util/exceptions.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'module/util/exceptions.scm') diff --git a/module/util/exceptions.scm b/module/util/exceptions.scm index a5605e48..3b135c5a 100644 --- a/module/util/exceptions.scm +++ b/module/util/exceptions.scm @@ -46,12 +46,16 @@ (lambda (fmt . args) (format #f "WARNING: ~?~%" fmt args)))) +(define-public warnings-are-errors + (make-parameter #f)) ;; forwards return from warning-hander. By default returns an unspecified value, ;; but instances are free to provide a proper return value and use it. (define-public (warning fmt . args) (display (apply (warning-handler) fmt (or args '())) - (current-error-port))) + (current-error-port)) + (when (warnings-are-errors) + (throw 'warning fmt args))) (define-public (fatal fmt . args) (display (format #f "FATAL: ~?~%" fmt (or args '())) -- cgit v1.2.3