Merge pull request #51 from ducky427/master

Set goog.DEBUG and only check schema in development
This commit is contained in:
Artūr Girenko 2016-05-14 21:38:18 +02:00
commit 9a3123f687
3 changed files with 12 additions and 6 deletions

View File

@ -11,11 +11,13 @@
(defn check-and-throw (defn check-and-throw
"throw an exception if db doesn't match the schema." "throw an exception if db doesn't match the schema."
[a-schema db] [a-schema db]
(if-let [problems (s/check a-schema db)] (when-let [problems (s/check a-schema db)]
(throw (js/Error. (str "schema check failed: " problems))))) (throw (js/Error. (str "schema check failed: " problems)))))
(def validate-schema-mw (def validate-schema-mw
(after (partial check-and-throw schema))) (if goog.DEBUG
(after (partial check-and-throw schema))
[]))
;; -- Handlers -------------------------------------------------------------- ;; -- Handlers --------------------------------------------------------------

View File

@ -11,11 +11,13 @@
(defn check-and-throw (defn check-and-throw
"throw an exception if db doesn't match the schema." "throw an exception if db doesn't match the schema."
[a-schema db] [a-schema db]
(if-let [problems (s/check a-schema db)] (when-let [problems (s/check a-schema db)]
(throw (js/Error. (str "schema check failed: " problems))))) (throw (js/Error. (str "schema check failed: " problems)))))
(def validate-schema-mw (def validate-schema-mw
(after (partial check-and-throw schema))) (if goog.DEBUG
(after (partial check-and-throw schema))
[]))
;; -- Handlers -------------------------------------------------------------- ;; -- Handlers --------------------------------------------------------------

View File

@ -35,12 +35,14 @@
:output-dir "target/ios" :output-dir "target/ios"
:static-fns true :static-fns true
:optimize-constants true :optimize-constants true
:optimizations :simple}} :optimizations :simple
:closure-defines {"goog.DEBUG" false}}}
:android {:source-paths ["src" "env/prod"] :android {:source-paths ["src" "env/prod"]
:compiler {:output-to "index.android.js" :compiler {:output-to "index.android.js"
:main "env.android.main" :main "env.android.main"
:output-dir "target/android" :output-dir "target/android"
:static-fns true :static-fns true
:optimize-constants true :optimize-constants true
:optimizations :simple}}}} :optimizations :simple
:closure-defines {"goog.DEBUG" false}}}}}
}}) }})