abdef62
Branches > refactor/use-spec-1 > abdef62 > files / src / dev / grahp / error.clj
Throw an exception on a bad reader
Commit: abdef623a1dac2856b8dbada23aa6d24a2c922bb
Parent: 6f4938c
1 changed file:
src/net/bowmap/codecs/read.clj view file
@@ -47,6 +47,9 @@ :varint `read-varint! :string `read-string!}) +(defn reader [t]+ (or (readers t) (raise "No such type!" {:type t})))+ (defn read-enum! [codec m buf] (m (codec buf))) @@ -56,4 +59,4 @@ ; Otherwise nils can easily creep into these functions and cause random NPEs (def composite-readers {:enum (fn [t enum-fn]- `(fn [buf#] (read-enum! ~(readers t) ~enum-fn buf#)))})+ `(fn [buf#] (read-enum! ~(reader t) ~enum-fn buf#)))})