Allow false; fail if too many components in vector given.

This commit is contained in:
Nick Alexander 2016-08-03 17:02:20 -07:00
parent f25838a1eb
commit 417ae1ed92

View file

@ -504,7 +504,7 @@
(let [[op e a v tx] entity]
[op e a v (or tx current-tx)]))
(defn ensure-entity-form [[op e a v tx :as entity]]
(defn ensure-entity-form [[op e a v tx & rest :as entity]]
(cond
(not (sequential? entity))
(raise "Bad entity " entity ", should be sequential at this point"
@ -514,18 +514,22 @@
(raise "Unrecognized operation " op " expected one of :db/add :db/retract at this point"
{:error :transact/bad-operation :entity entity })
(not e)
(nil? e)
(raise "Bad entity: nil e in " entity
{:error :transact/bad-entity :entity entity })
(not a)
(nil? a)
(raise "Bad entity: nil a in " entity
{:error :transact/bad-entity :entity entity })
(not v)
(nil? v)
(raise "Bad entity: nil v in " entity
{:error :transact/bad-entity :entity entity })
(some? rest)
(raise "Bad entity: too long " entity
{:error :transact/bad-entity :entity entity })
true
entity))