conditions.lisp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ;; This software is Copyright (c) Leslie P. Polzer, 2011.
  2. ;; Leslie P. Polzer 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 i18n-conditions)
  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 parsing-pofile-error (text-error)
  18. ()
  19. (:report (lambda (condition stream)
  20. (format stream "~a" (text condition)))))
  21. (define-condition parsing-mofile-error (text-error)
  22. ()
  23. (:report (lambda (condition stream)
  24. (format stream "~a" (text condition)))))
  25. (define-condition parsing-utxfile-error (text-error)
  26. ()
  27. (:report (lambda (condition stream)
  28. (format stream "~a" (text condition)))))
  29. (define-condition no-translation-table-error (text-error)
  30. ()
  31. (:report (lambda (condition stream)
  32. (format stream "~a" (text condition)))))
  33. (define-condition no-translation (text-warning)
  34. ()
  35. (:report (lambda (condition stream)
  36. (format stream "~a" (text condition)))))
  37. (define-condition text-error (error)
  38. ((text
  39. :initarg :text
  40. :reader text))
  41. (:documentation "Error that set text"))
  42. (define-condition not-implemented-error (text-error)
  43. ()
  44. (:documentation "Error for not-implemented features"))
  45. (define-condition null-reference (text-error)
  46. ()
  47. (:documentation "Null reference"))
  48. (define-condition out-of-bounds (error)
  49. ((seq
  50. :initarg :seq
  51. :reader seq)
  52. (idx
  53. :initarg :idx
  54. :reader idx))
  55. (:documentation "Error when you go out of bound"))