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) (list :head (injections-for :head)
:body (injections-for :body)))) :body (injections-for :body))))
(define-condition theme-does-not-exist-error (error) (define-condition theme-does-not-exist (error)
((theme :initarg :theme :reader theme)) ((theme :initarg :theme :reader theme))
(:report (lambda (c stream) (: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) (defun theme-package (name)
"Find the package matching the theme NAME. "Find the package matching the theme NAME or signal THEME-DOES-NOT-EXIST."
It will signal an error when it cannot find the package for the theme."
(or (find-package (string-upcase (concatenate 'string "coleslaw.theme." name))) (or (find-package (string-upcase (concatenate 'string "coleslaw.theme." name)))
(error 'theme-does-not-exist-error (error 'theme-does-not-exist-error :theme name)))
:theme name)))
(defun theme-fn (name &optional (package (theme *config*))) (defun theme-fn (name &optional (package (theme *config*)))
"Find the symbol NAME inside PACKAGE which defaults to the theme package." "Find the symbol NAME inside PACKAGE which defaults to the theme package."