Skip to content

Instantly share code, notes, and snippets.

@stevebuik
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)
(do
(doseq [[req res] errors]
@stevebuik
stevebuik / gist:7a8b4a8bc63cec2a6f40
Last active Aug 29, 2015
Database function test case
View gist:7a8b4a8bc63cec2a6f40
(ns scratch.db-fns-test-case
(:require
[datomic.api :refer (q db) :as d]))
(def test-state (atom
{:db-str "datomic:free://localhost:4334/somedb"
;:db-str"datomic:mem://test"
}))
(swap! test-state