Minor cleanups to theme-package error handling.

This commit is contained in:
Brit Butler 2013-04-18 14:41:43 -04:00
parent e7caa267a3
commit eb1c5d8f83

View file

@ -22,17 +22,15 @@ any return value other than nil indicates the injection should be added."
(list :head (injections-for :head)
:body (injections-for :body))))
(define-condition theme-does-not-exist-error (error)
(define-condition theme-does-not-exist (error)
((theme :initarg :theme :reader theme))
(:report (lambda (c stream)
(format stream "THEME-DOES-NOT-EXIST-ERROR cannot find theme: '~A'" (theme c)))))
(format stream "Cannot find the theme: '~A'" (theme c)))))
(defun theme-package (name)
"Find the package matching the theme NAME.
It will signal an error when it cannot find the package for the theme."
"Find the package matching the theme NAME or signal THEME-DOES-NOT-EXIST."
(or (find-package (string-upcase (concatenate 'string "coleslaw.theme." name)))
(error 'theme-does-not-exist-error
:theme name)))
(error 'theme-does-not-exist-error :theme name)))
(defun theme-fn (name &optional (package (theme *config*)))
"Find the symbol NAME inside PACKAGE which defaults to the theme package."