From 4424a420f021fcebdd3bcd96fd76478da5d88fee Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 20 Oct 2019 22:37:00 -0700 Subject: [PATCH] Furthur improve error reporting for libraries. --- src/runtime/library-database.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/runtime/library-database.scm b/src/runtime/library-database.scm index 23919a9ab..2c71c93d3 100644 --- a/src/runtime/library-database.scm +++ b/src/runtime/library-database.scm @@ -118,7 +118,10 @@ USA. (if (not auto) (error "Unknown property:" key)) (if (not (auto-runnable? auto this)) - (error "Auto property not ready:" key)) + (error "Auto property not ready:" + key + (error-irritant/noise " because of") + (auto-unready-deps auto this))) (let ((bindings (run-auto auto this))) (set-cdr! alist (append bindings (cdr alist))) (cdr (assq key bindings))))))) @@ -213,6 +216,18 @@ USA. (library 'get key)) (auto-deps auto)))))) +(define (auto-unready-deps auto library) + (if (every (lambda (key) + (library 'has? key)) + (auto-deps auto)) + (list "guard expr") + (map (lambda (key) + (let ((auto* (automatic-property key))) + (if auto* + (cons key (auto-unready-deps auto* library)) + key))) + (auto-deps auto)))) + (define (run-auto auto library) (let ((runner (lambda () -- 2.25.1