 
 (defn path-for [handler & params]
   (apply bidi/path-for routes handler params))
+
+(defn error-body [msg]
+  {:links {:up {:href (path-for :service-document-handler)}}
+   :error msg})
+
+(defn error [status msg]
+  {:status status
+   :body (error-body msg)})
 
 (defn workbook-path [workbook]
   (path-for :workbook-handler :id (:workbook/id workbook)))

     :name (:branch/name branch)})

  :handle-not-found
  {:links {:up {:href (path-for :service-document-handler)}}
   :error "Branch not found."})

(defn decode-etag [etag]
  (subs etag 1 (dec (count etag))))

(defn error [status msg]
  {:status status
   :body
   {:links {:up {:href (path-for :service-document-handler)}}
    :error msg}})

(defnk put-branch-handler [[:params conn id] headers :as req]
  (if-let [new-workbook-id (:workbook-id (:params req))]


(def media-types ["application/json" "application/transit+json"
                  "application/edn"])

(defn decode-etag [etag]
  (subs etag 1 (dec (count etag))))

;; ---- Routes ----------------------------------------------------------------

