abdef62

Branches > main > abdef62 > files / src / dev

Throw an exception on a bad reader

Grahp, 2026-02-26

Commit: abdef623a1dac2856b8dbada23aa6d24a2c922bb
Parent: 6f4938c

1 changed file:

src/net/bowmap/codecs/read.clj modified (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#)))})