-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathconditions.lisp
33 lines (27 loc) · 1.55 KB
/
conditions.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(in-package #:org.shirakumo.maiden)
(define-condition maiden-condition (condition)
())
(define-condition core-condition (maiden-condition)
((core :initarg :core :reader core))
(:default-initargs :core (error "CORE required.")))
(define-condition consumer-name-duplicated-warning (core-condition warning)
((existing-consumer :initarg :existing-consumer :reader existing-consumer)
(new-consumer :initarg :new-consumer :reader new-consumer))
(:default-initargs
:existing-consumer (error "EXISTING-CONSUMER required.")
:new-consumer (error "NEW-CONSUMER required."))
(:report (lambda (c s) (format s "A consumer with the name ~s (~a) ~
already exists when adding ~a to ~a."
(name (existing-consumer c)) (existing-consumer c)
(new-consumer c) (core c)))))
(define-condition agent-condition (maiden-condition)
((agent :initarg :agent :reader agent))
(:default-initargs :agent (error "AGENT required.")))
(define-condition agent-already-exists-error (core-condition agent-condition)
((existing-agent :initarg :existing-agent :reader existing-agent))
(:default-initargs :existing-agent (error "EXISTING-AGENT required."))
(:report (lambda (c s) (format s "An agent of the same class ~s (~a) already exists."
(class-name (class-of (agent c))) (existing-agent c)))))
(define-condition client-condition (maiden-condition)
((client :initarg :client :reader client))
(:default-initargs :client (error "CLIENT required.")))