annotate base/conditions.lisp @ 224:7afb8cfdcdcf

add composition slot to event (geerdes) Ignore-this: 7ece48560d6cc689711c5864e49a0360 darcs-hash:20090828164054-16a00-57b981532296c149640ab1e48439cdb88c41f2cf.gz committer: Jamie Forth <j.forth@gold.ac.uk>
author j.forth <j.forth@gold.ac.uk>
date Thu, 24 Feb 2011 11:23:18 +0000
parents b16472d7823f
children 376357c84189
rev   line source
m@24 1 (cl:in-package #:amuse)
m@24 2
m@24 3 ;; Some conditions we might want to be able to signal
m@24 4
m@24 5 (define-condition undefined-action (condition)
m@24 6 ;; This condition would apply to an attempt to perform a meaningless
m@24 7 ;; operation on an object. This may, initially, include things that
m@24 8 ;; are a pain to implement but should really be used when it's
m@24 9 ;; genuinely unclear what an operation means in the given
m@24 10 ;; context. In such cases, a condition handler might be the best
m@24 11 ;; approach anyway.
m@24 12 ((operation :initarg :operation
m@24 13 :reader undefined-action-operation)
m@24 14 (datatype :initarg :datatype
m@24 15 :reader undefined-action-datatype))
m@24 16 (:report (lambda (condition stream)
m@172 17 (format stream "The consequence of performing ~A on an object of type ~A is undefined."
m@24 18 (undefined-action-operation condition)
m@24 19 (undefined-action-datatype condition)))))
m@24 20
m@24 21 (define-condition insufficient-information (condition)
m@24 22 ;; It should be possible to construct genuinely minimal musical
m@24 23 ;; structures. When the information in these is insufficient to
m@24 24 ;; answer a query, this condition should be raised.
m@24 25 ((operation :initarg :operation
m@24 26 :reader insufficient-information-operation)
m@24 27 (datatype :initarg :datatype
m@24 28 :reader insufficient-information-datatype))
m@24 29 (:report (lambda (condition stream)
m@172 30 (format stream "The ~A object does not contain enough information to perform ~A."
m@24 31 (insufficient-information-datatype condition)
m@24 32 (insufficient-information-operation condition)))))
m@24 33
m@24 34