(defun validate-post (title title-supplied-p path path-supplied-p) (let ((errors '())) (when title-supplied-p (unless (post-title-p title) (setf errors (acons 'title "Invalid title" errors)))) (when path-supplied-p (unless (post-path-p path) (setf errors (acons 'path "Invalid path" errors)))) errors)) (defun perform-update-post (post title title-supplied-p path path-supplied-p) (setf (slot-value post 'title) title (slot-value post 'path) path) (mito:save-dao post) (values t nil)) (defun update-post (post &key (title nil title-supplied-p) (path nil path-supplied-p)) (let ((errors (validate-post title title-supplied-p path path-supplied-p))) (if errors (values nil errors) (handler-case (perform-update-post post title title-supplied-p path path-supplied-p) (error (e) (values nil (list 'db-error error)))))))