diff --git a/backend/resources/migrations/0004.pages.up.sql b/backend/resources/migrations/0004.pages.up.sql index 2c9eb4b3b..22670e35d 100644 --- a/backend/resources/migrations/0004.pages.up.sql +++ b/backend/resources/migrations/0004.pages.up.sql @@ -10,6 +10,8 @@ CREATE TABLE IF NOT EXISTS pages ( modified_at timestamptz NOT NULL DEFAULT clock_timestamp(), deleted_at timestamptz DEFAULT NULL, + ordering smallint, + name text NOT NULL, data bytea NOT NULL, metadata bytea NOT NULL @@ -27,7 +29,8 @@ CREATE TABLE IF NOT EXISTS pages_history ( pinned bool NOT NULL DEFAULT false, label text NOT NULL DEFAULT '', - data bytea NOT NULL + data bytea NOT NULL, + metadata bytea NOT NULL ); -- Indexes diff --git a/backend/src/uxbox/http/errors.clj b/backend/src/uxbox/http/errors.clj index 328ecac3c..614371667 100644 --- a/backend/src/uxbox/http/errors.clj +++ b/backend/src/uxbox/http/errors.clj @@ -10,29 +10,31 @@ [clojure.tools.logging :as log] [io.aviso.exception :as e])) -(defmulti handle-exception #(:type (ex-data %))) +(defmulti handle-exception + (fn [err & rest] + (:type (ex-data err)))) (defmethod handle-exception :validation - [err] + [err req] (let [response (ex-data err)] {:status 400 :body response})) (defmethod handle-exception :not-found - [err] + [err req] (let [response (ex-data err)] {:status 404 :body response})) (defmethod handle-exception :parse - [err] + [err req] {:status 400 :body {:type :parse :message (ex-message err)}}) (defmethod handle-exception :default - [err] - (log/error err "Unhandled exception on request:") + [err req] + (log/error err "Unhandled exception on request:" (:path req)) {:status 500 :body {:type :exception :message (ex-message err)}}) @@ -41,5 +43,5 @@ [error req] (if (or (instance? java.util.concurrent.CompletionException error) (instance? java.util.concurrent.ExecutionException error)) - (handle-exception (.getCause error)) - (handle-exception error))) + (handle-exception (.getCause error) req) + (handle-exception error req)))