Import backend code inside the repository.

This commit is contained in:
Andrey Antukh 2016-11-20 20:04:52 +01:00
parent e21798f1ed
commit de57630c14
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
113 changed files with 8040 additions and 0 deletions

View file

@ -0,0 +1,21 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.exceptions
"A helpers for work with exceptions.")
(defn error
[& {:keys [type code message] :or {type :unexpected} :as payload}]
{:pre [(keyword? type) (keyword? code)]}
(let [message (if message
(str message " / " (pr-str code) "")
(pr-str code))
payload (assoc payload :type type)]
(ex-info message payload)))
(defmacro raise
[& args]
`(throw (error ~@args)))