1
0
Fork 0

- [RPC] fixed server stopping;

- [GUI] notify RPC errors to the user using the GUI.
This commit is contained in:
cage 2023-02-10 12:57:08 +01:00
parent 7b415e485a
commit a973a8fbe1
3 changed files with 15 additions and 12 deletions

View File

@ -62,6 +62,16 @@
(defun find-db-stream-url (url)
(find-db-stream-if (lambda (a) (string= (server-stream-handle a) url))))
(defun notify-request-error (e)
(gui-goodies:error-dialog gui:*tk*
(format nil (_ "Comunication with backend failed: ~a") e)))
(defmacro with-notify-errors (&body body)
`(handler-case
(progn ,@body)
(error (e)
(notify-request-error e))))
(defmacro with-enqueue-request ((method-name id &rest args) &body on-error)
`(ev:with-enqueued-process-and-unblock ()
(handler-case
@ -123,19 +133,9 @@
(setf (fetching-thread stream-wrapper) stream-thread)
(push-db-stream stream-wrapper))))))
(defun notify-request-error (e)
(gui-goodies:error-dialog gui:*tk*
(format nil (_ "Comunication with backend failed: ~a") e)))
(defmacro with-notify-errors (&body body)
`(handler-case
(progn ,@body)
(error (e)
(notify-request-error e))))
(defun initialize-menu (parent)
(with-accessors ((main-window main-window)) parent
(let* ((bar (gui:make-menubar))
(let* ((bar (gui:make-menubar parent))
(file (gui:make-menu bar (_ "File") :underline 0))
(help (gui:make-menu bar (_ "Help") :underline 0)))
(gui:make-menubutton file (_ "Quit") #'menu:quit :underline 0)

View File

@ -49,6 +49,9 @@
(write-byte +command-delimiter+ *server-output-stream*)
(finish-output *server-output-stream*))
(defun stop-server ()
(setf *stop-server* t))
(defun start-server ()
(init-gemini-window)
(prepare-rpc

View File

@ -29,7 +29,7 @@
(fs:clean-temporary-directories)
(fs:clean-temporary-files)
(db-utils:close-db)
(setf *stop-server* t))
(stop-server))
(defmacro prepare-rpc (&body body)
`(let ((rpc:*function-db* '()))