fix cs-hx message handling; actor: trying to improve error handling

This commit is contained in:
Helmut Merz 2025-06-21 20:22:50 +02:00
parent c3afd20f5f
commit 87afabd467
2 changed files with 9 additions and 5 deletions

View file

@ -53,16 +53,20 @@
(defgeneric ac-loop (tsk bhv) (defgeneric ac-loop (tsk bhv)
(:method ((tsk async:task) bhv) (:method ((tsk async:task) bhv)
(let ((msg (async:rcv tsk))) (let ((msg (async:rcv tsk)))
(unless (eq (content msg) +quit-message+) (unless (eq (ac-step tsk bhv msg) +quit-message+)
(ac-step tsk bhv msg)
(ac-loop tsk (async:behavior tsk)))))) (ac-loop tsk (async:behavior tsk))))))
(defun ac-step (tsk bhv msg) (defun ac-step (tsk bhv msg)
(when (eq (content msg) +quit-message+)
(return-from ac-step +quit-message+))
(let ((*self* tsk)) (let ((*self* tsk))
(handler-case (funcall bhv msg) (handler-case (funcall bhv msg)
(condition (err) (condition (err)
(invoke-debugger err)
(util:lg :error "behavior" msg err) (util:lg :error "behavior" msg err)
+quit-message+)
(error (err)
(invoke-debugger err)
;(util:lg :error "behavior" msg err)
)))) ))))
;;;; the core (classical, i.e. Hewitt) actor API ;;;; the core (classical, i.e. Hewitt) actor API

View file

@ -20,7 +20,7 @@
(defmethod response:render-content ((resp response) msg) (defmethod response:render-content ((resp response) msg)
;(dom:render (dom:dlist nil (shape:data msg)))) ;(dom:render (dom:dlist nil (shape:data msg))))
(let ((tmpl (gethash (shape:head-value msg :action) *templates*))) (let ((tmpl (or (gethash (shape:head-value msg :action) *templates*) #'view)))
(dom:render (funcall tmpl resp msg)))) (dom:render (funcall tmpl resp msg))))
(defun view (resp msg) (defun view (resp msg)