From a8cf072bda87cc231500541948c4de11a21d5976 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 31 Jan 2024 18:49:21 +0100 Subject: [PATCH] :sparkles: Add proper error report on binfile/v1 exportation --- backend/src/app/rpc/commands/binfile.clj | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/backend/src/app/rpc/commands/binfile.clj b/backend/src/app/rpc/commands/binfile.clj index 2621cce6a2..8f2216e636 100644 --- a/backend/src/app/rpc/commands/binfile.clj +++ b/backend/src/app/rpc/commands/binfile.clj @@ -8,6 +8,7 @@ (:refer-clojure :exclude [assert]) (:require [app.binfile.v1 :as bf.v1] + [app.common.logging :as l] [app.common.schema :as sm] [app.db :as db] [app.http.sse :as sse] @@ -50,11 +51,16 @@ ::rres/headers {"content-type" "application/octet-stream"} ::rres/body (reify rres/StreamableResponseBody (-write-body-to-stream [_ _ output-stream] - (-> cfg - (assoc ::bf.v1/ids #{file-id}) - (assoc ::bf.v1/embed-assets embed-assets) - (assoc ::bf.v1/include-libraries include-libraries) - (bf.v1/export-files! output-stream))))})) + (try + (-> cfg + (assoc ::bf.v1/ids #{file-id}) + (assoc ::bf.v1/embed-assets embed-assets) + (assoc ::bf.v1/include-libraries include-libraries) + (bf.v1/export-files! output-stream)) + (catch Throwable cause + (l/err :hint "exception on exporting file" + :file-id (str file-id) + :cause cause)))))})) ;; --- Command: import-binfile