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
|
io901tp@321
|
35 (define-condition invalid-argument (condition)
|
io901tp@321
|
36 ;; This condition applies if a function is invoked with an invalid
|
io901tp@321
|
37 ;; argument.
|
io901tp@321
|
38 ((function :initarg :function
|
io901tp@321
|
39 :reader invalid-argument-function)
|
io901tp@321
|
40 (argument :initarg :argument
|
io901tp@321
|
41 :reader invalid-argument-argument))
|
io901tp@321
|
42 (:report (lambda (condition stream)
|
io901tp@321
|
43 (format stream "The function ~A is not defined for a call with ~A"
|
io901tp@321
|
44 (invalid-argument-function condition)
|
io901tp@321
|
45 (invalid-argument-argument condition))))) |