From 87afabd467f565b89b65028f9c10fae237ae7e28 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sat, 21 Jun 2025 20:22:50 +0200 Subject: [PATCH] fix cs-hx message handling; actor: trying to improve error handling --- core/actor.lisp | 12 ++++++++---- frontend/cs-hx.lisp | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/core/actor.lisp b/core/actor.lisp index 167fe38..50bad32 100644 --- a/core/actor.lisp +++ b/core/actor.lisp @@ -53,16 +53,20 @@ (defgeneric ac-loop (tsk bhv) (:method ((tsk async:task) bhv) (let ((msg (async:rcv tsk))) - (unless (eq (content msg) +quit-message+) - (ac-step tsk bhv msg) + (unless (eq (ac-step tsk bhv msg) +quit-message+) (ac-loop tsk (async:behavior tsk)))))) (defun ac-step (tsk bhv msg) + (when (eq (content msg) +quit-message+) + (return-from ac-step +quit-message+)) (let ((*self* tsk)) (handler-case (funcall bhv msg) - (condition (err) - (invoke-debugger err) + (condition (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 diff --git a/frontend/cs-hx.lisp b/frontend/cs-hx.lisp index fd33e19..076a465 100644 --- a/frontend/cs-hx.lisp +++ b/frontend/cs-hx.lisp @@ -20,7 +20,7 @@ (defmethod response:render-content ((resp response) 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)))) (defun view (resp msg)