From 9eaa55b7110b58eccc92234b930a83af69b18468 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 7 Nov 2024 20:50:01 +0100 Subject: [PATCH] :sparkles: Prevent logging EOF exceptions on SSE responses They are not necessary and they are pretty common, because the user can interrupt the connection at any time. --- backend/src/app/http/sse.clj | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/backend/src/app/http/sse.clj b/backend/src/app/http/sse.clj index fb7f75e2d..f00422a27 100644 --- a/backend/src/app/http/sse.clj +++ b/backend/src/app/http/sse.clj @@ -9,6 +9,7 @@ (:refer-clojure :exclude [tap]) (:require [app.common.data :as d] + [app.common.exceptions :as ex] [app.common.logging :as l] [app.common.transit :as t] [app.http.errors :as errors] @@ -60,13 +61,10 @@ (try (let [result (handler)] (events/tap :end result)) - - (catch java.io.EOFException cause - (events/tap :error (errors/handle' cause request))) (catch Throwable cause - (l/err :hint "unexpected error on processing sse response" - :cause cause) - (events/tap :error (errors/handle' cause request))) + (events/tap :error (errors/handle' cause request)) + (when-not (ex/instance? java.io.EOFException cause) + (l/err :hint "unexpected error on processing sse response" :cause cause))) (finally (sp/close! events/*channel*) (px/await! listener)))))))}))