From 83356eed2056e71803423ba61a7474bd3ed057b0 Mon Sep 17 00:00:00 2001 From: cage Date: Sat, 10 Apr 2021 21:14:20 +0200 Subject: [PATCH] - exit from the program, without launching the debugger, when the configuration module was not found but notify a warning if the module was not essential (like when loaded from the command line using switch "-M"). --- src/main.lisp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main.lisp b/src/main.lisp index 22ece8b..2e168e8 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -121,7 +121,12 @@ etc.) happened" ;; (init-db) (db-utils:with-ready-database (:connect nil) (complete:initialize-complete-username-cache) - (modules:load-module +starting-init-file+) + (handler-case + (modules:load-module +starting-init-file+) + (error (e) + (croatoan:end-screen) + (format *error-output* "~a~%" e) + (os-utils:exit-program 1))) ;; init main window for first... (main-window:init) (keybindings-window:init) @@ -141,11 +146,17 @@ etc.) happened" ;; now init the client (client:init) (client:authorize) + (when command-line:*module-file* + (handler-case + (modules:load-module command-line:*module-file*) + (error () + (ui:notify (format nil + (_ "Unable to load module ~a") + command-line:*module-file*) + :as-error t)))) (if command-line:*gemini-url* (gemini-viewer:load-gemini-url command-line:*gemini-url*) (progn - (when command-line:*module-file* - (modules:load-module command-line:*module-file*)) (let ((program-events:*process-events-immediately* t)) (when command-line:*start-timeline* (change-timeline))