Add error handling for startup failures

This commit is contained in:
Christopher Baines 2024-04-02 12:16:27 +01:00
parent 65f92ca701
commit 7f5f11048b

View file

@ -201,22 +201,29 @@
(call-with-new-thread (call-with-new-thread
(lambda () (lambda ()
(run-sqitch) (with-exception-handler
(lambda (exn)
(simple-format
(current-error-port)
"startup failed: ~A\n" exn)
(exit 1))
(lambda ()
(run-sqitch)
(for-each (for-each
(lambda (git-repository-details) (lambda (git-repository-details)
(when (fifth git-repository-details) (when (fifth git-repository-details)
(simple-format #t "starting thread to poll ~A (~A)\n" (simple-format #t "starting thread to poll ~A (~A)\n"
(second git-repository-details) (second git-repository-details)
(third git-repository-details)) (third git-repository-details))
(start-thread-to-poll-git-repository (start-thread-to-poll-git-repository
(first git-repository-details)))) (first git-repository-details))))
(with-postgresql-connection (with-postgresql-connection
"poll-startup" "poll-startup"
all-git-repositories)) all-git-repositories))
(atomic-box-set! startup-completed #t))) (atomic-box-set! startup-completed #t)))))
;; Provide some visual space between the startup output and the ;; Provide some visual space between the startup output and the
;; server starting ;; server starting