trap fewer exceptions

dev-gh-actions
Matthew Butterick 4 years ago
parent 9a838418e7
commit d86d0a00e8

@ -1 +1 @@
1612984970 1613427909

@ -52,6 +52,13 @@
;; but if something else is amiss, we want to let it bubble up ;; but if something else is amiss, we want to let it bubble up
(define setup-module-path (get-path-to-override dir)) (define setup-module-path (get-path-to-override dir))
(with-handlers ([exn:fail:contract? (λ (exn) DEFAULT-NAME)] (with-handlers ([exn:fail:contract? (λ (exn) DEFAULT-NAME)]
;; a syntax error in pollen.rkt will arrive here
;; exn:fail:read? for a syntactic failure (e.g., missing paren)
;; exn:fail:syntax? for a semantic failure, (e.g., unbound identifier)
;; it does not indicate a defective setup module,
;; so pass it through
[exn:fail:read? raise]
[exn:fail:syntax? raise]
[exn? (λ (exn) (raise-user-error 'pollen/setup [exn? (λ (exn) (raise-user-error 'pollen/setup
(format "defective `setup` submodule in ~v\n~a" (path->string setup-module-path) (exn-message exn))))]) (format "defective `setup` submodule in ~v\n~a" (path->string setup-module-path) (exn-message exn))))])
(dynamic-require `(submod ,setup-module-path WORLD-SUBMOD) (dynamic-require `(submod ,setup-module-path WORLD-SUBMOD)

Loading…
Cancel
Save