Skip to content

Instantly share code, notes, and snippets.

stevebuik / parser.clj
Created Nov 1, 2015
An example of logging and sanitizing server parsers exceptions
View parser.clj
(defn handle
[env params]
(let [p (parser {:read readf
:mutate mutatef})
result (p env params)
errors (->> result
(filter (fn [[k v]] (instance? Throwable v))))]
(if (seq errors)
(doseq [[req res] errors]
stevebuik / gist:7a8b4a8bc63cec2a6f40
Last active Aug 29, 2015
Database function test case
View gist:7a8b4a8bc63cec2a6f40
(ns scratch.db-fns-test-case
[datomic.api :refer (q db) :as d]))
(def test-state (atom
{:db-str "datomic:free://localhost:4334/somedb"
(swap! test-state