mirror of
https://github.com/penpot/penpot.git
synced 2025-06-05 17:11:40 +02:00
✨ Improve error handling on websocket code
This commit is contained in:
parent
ec2eb3d406
commit
43b8ccb52e
1 changed files with 9 additions and 7 deletions
|
@ -15,6 +15,7 @@
|
||||||
[app.util.time :as dt]
|
[app.util.time :as dt]
|
||||||
[promesa.exec :as px]
|
[promesa.exec :as px]
|
||||||
[promesa.exec.csp :as sp]
|
[promesa.exec.csp :as sp]
|
||||||
|
[promesa.util :as pu]
|
||||||
[ring.request :as rreq]
|
[ring.request :as rreq]
|
||||||
[ring.websocket :as rws]
|
[ring.websocket :as rws]
|
||||||
[yetti.websocket :as yws])
|
[yetti.websocket :as yws])
|
||||||
|
@ -185,17 +186,18 @@
|
||||||
(rws/send channel message)
|
(rws/send channel message)
|
||||||
(recur i))))))
|
(recur i))))))
|
||||||
|
|
||||||
(catch java.nio.channels.ClosedChannelException _)
|
|
||||||
(catch java.net.SocketException _)
|
|
||||||
(catch java.io.IOException _)
|
|
||||||
|
|
||||||
(catch InterruptedException _cause
|
(catch InterruptedException _cause
|
||||||
(l/dbg :hint "websocket thread interrumpted" :conn-id id))
|
(l/dbg :hint "websocket thread interrumpted" :conn-id id))
|
||||||
|
|
||||||
(catch Throwable cause
|
(catch Throwable cause
|
||||||
(l/err :hint "unhandled exception on websocket thread"
|
(let [cause (pu/unwrap-exception cause)]
|
||||||
:conn-id id
|
(if (or (instance? java.nio.channels.ClosedChannelException cause)
|
||||||
:cause cause))
|
(instance? java.net.SocketException cause)
|
||||||
|
(instance? java.io.IOException cause))
|
||||||
|
nil
|
||||||
|
(l/err :hint "unhandled exception on websocket thread"
|
||||||
|
:conn-id id
|
||||||
|
:cause cause))))
|
||||||
(finally
|
(finally
|
||||||
(try
|
(try
|
||||||
(handler wsp {:type :close})
|
(handler wsp {:type :close})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue