From e17cb3459d48d491e9f8d93bc32841a54a12f1c6 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Thu, 12 Jul 2012 15:01:21 -0700 Subject: [PATCH] Added warn-errors?, like ignore-errors, to turn errors into warnings. --- src/runtime/error.scm | 8 ++++++++ src/runtime/runtime.pkg | 1 + 2 files changed, 9 insertions(+) diff --git a/src/runtime/error.scm b/src/runtime/error.scm index e01ace41d..502a5f123 100644 --- a/src/runtime/error.scm +++ b/src/runtime/error.scm @@ -1230,6 +1230,14 @@ USA. 'IGNORE-ERRORS))) thunk)))) +(define warn-errors? + (let ((ok "ok")) + (lambda (thunk) + (let ((v (ignore-errors (lambda () (thunk) ok)))) + (cond ((eq? v ok) #f) + ((condition? v) (warn v) #t) + (else (error "Unexpected value:" v))))))) + (define (format-error-message message irritants port) (fluid-let ((*unparser-list-depth-limit* 2) (*unparser-list-breadth-limit* 5)) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 23ee71521..2e64aa00a 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -1817,6 +1817,7 @@ USA. format-error-message hook/invoke-condition-handler ignore-errors + warn-errors? invoke-restart invoke-restart-interactively make-condition -- 2.25.1