アットウィキロゴ

Common Lispのコンディションシステム1

(define-condition sample-condition (error)
 ((sample-cond
       :initarg :text
       :reader text-of))
 (:report (lambda (c s)
             (format s "this is sample error : ~A~%" (text-of c)))))

(defun condition-test ()
 (error 'sample-condition :text "condition arg"))

(defun testit ()
 (handler-case
     (condition-test)
   (sample-condition (sample-arg)
     (format t "passed arg is it -> ~A~%" (text-of sample-arg)))))
最終更新:2014年07月27日 18:12