conditions.lisp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ;; This software is Copyright (c) cage
  2. ;; cage grants you the rights to distribute
  3. ;; and use this software as governed by the terms
  4. ;; of the Lisp Lesser GNU Public License
  5. ;; (http://opensource.franz.com/preamble.html),
  6. ;; known as the LLGPL
  7. (in-package cl-pslib)
  8. (defmacro defcond (type)
  9. `(define-condition ,(alexandria:format-symbol t "TEXT-~a" (string-upcase type))
  10. (,type)
  11. ((text
  12. :initarg :text
  13. :reader text))
  14. (:documentation "Error that set text")))
  15. (defcond error)
  16. (defcond warning)
  17. (define-condition bookmark-error (text-error)
  18. ()
  19. (:report (lambda (condition stream)
  20. (format stream "~a" (text condition)))))
  21. (define-condition spotcolor-error (text-error)
  22. ()
  23. (:report (lambda (condition stream)
  24. (format stream "~a" (text condition)))))
  25. (define-condition image-load-error (text-error)
  26. ()
  27. (:report (lambda (condition stream)
  28. (format stream "~a" (text condition)))))
  29. (define-condition shading-pattern-error (text-error)
  30. ()
  31. (:report (lambda (condition stream)
  32. (format stream "~a" (text condition)))))
  33. (define-condition not-implemented-error (text-error)
  34. ()
  35. (:documentation "Error for not-implemented features"))
  36. (define-condition null-reference (text-error)
  37. ()
  38. (:documentation "Null reference"))
  39. (define-condition out-of-bounds (error)
  40. ((seq
  41. :initarg :seq
  42. :reader seq)
  43. (idx
  44. :initarg :idx
  45. :reader idx))
  46. (:documentation "Error when you go out of bound"))