view base/conditions.lisp @ 310:f99fd6a7bbfc

Add midi-db. Ignore-this: c6f4fc32efa4453ddbdc478793eedd52 A basic implementation for working with MIDI files stored in the database. It is a test case for `versioned' data, but only partially implemented at the moment. darcs-hash:20100223152703-16a00-4388d2720907d777a1c6c6b3a010885ce0fe06a7.gz
author j.forth <j.forth@gold.ac.uk>
date Tue, 23 Feb 2010 15:27:03 +0000
parents b16472d7823f
children 376357c84189
line wrap: on
line source
(cl:in-package #:amuse) 

;; Some conditions we might want to be able to signal

(define-condition undefined-action (condition)
  ;; This condition would apply to an attempt to perform a meaningless
  ;; operation on an object. This may, initially, include things that
  ;; are a pain to implement but should really be used when it's
  ;; genuinely unclear what an operation means in the given
  ;; context. In such cases, a condition handler might be the best
  ;; approach anyway.
  ((operation :initarg :operation
	      :reader undefined-action-operation)
   (datatype :initarg :datatype
	     :reader undefined-action-datatype))
  (:report (lambda (condition stream)
	     (format stream "The consequence of performing ~A on an object of type ~A is undefined."
		     (undefined-action-operation condition)
		     (undefined-action-datatype condition)))))

(define-condition insufficient-information (condition)
  ;; It should be possible to construct genuinely minimal musical
  ;; structures. When the information in these is insufficient to
  ;; answer a query, this condition should be raised.
  ((operation :initarg :operation
	      :reader insufficient-information-operation)
   (datatype :initarg :datatype
	     :reader insufficient-information-datatype))
  (:report (lambda (condition stream)
	     (format stream "The ~A object does not contain enough information to perform ~A."
		     (insufficient-information-datatype condition)
		     (insufficient-information-operation condition)))))