Throw error when unsupported keyword is used

This commit is contained in:
oakes
2014-01-12 23:13:05 -05:00
parent 3feee36e8f
commit 0cd02856cc

View File

@@ -41,10 +41,10 @@
(defn cell! (defn cell!
[^Cell cell & args] [^Cell cell & args]
(let [method-name (first args) (let [method (first args)
[[a1 a2 a3 a4] rest-args] (split-with #(not (keyword? %)) (rest args))] [[a1 a2 a3 a4] rest-args] (split-with #(not (keyword? %)) (rest args))]
(when method-name (when method
(case method-name (case method
:width (.width cell ^double a1) :width (.width cell ^double a1)
:height (.height cell ^double a1) :height (.height cell ^double a1)
:size (.size cell ^double a1 ^double a2) :size (.size cell ^double a1 ^double a2)
@@ -82,7 +82,7 @@
:uniform-x (.uniformX cell) :uniform-x (.uniformX cell)
:uniform-y (.uniformY cell) :uniform-y (.uniformY cell)
:row (.row cell) :row (.row cell)
nil) (throw (Exception. (str "The keyword " method " is not supported."))))
(apply cell! cell rest-args)) (apply cell! cell rest-args))
cell)) cell))
@@ -102,7 +102,7 @@
(keyword? child) (keyword? child)
(case child (case child
:row (.row ^Table (:object parent)) :row (.row ^Table (:object parent))
nil))) (throw (Exception. (str "The keyword " child " is not supported."))))))
(defn ^:private create-tree-node (defn ^:private create-tree-node
[child] [child]