@@ -45,6 +45,7 @@ import Data.Text qualified as Text
4545import Data.Text.Encoding qualified as Text
4646import Data.Text.IO qualified as Text
4747import GHC.Stack (CallStack , callStack , prettyCallStack )
48+ import Network.WebSockets qualified as WS
4849import Servant.Client qualified as Servant
4950import Share.Env.Types qualified as Env
5051import Share.OAuth.Errors (OAuth2Error )
@@ -56,6 +57,8 @@ import Share.Utils.Logging.Types as X
5657import Share.Utils.Tags (MonadTags )
5758import System.Log.FastLogger qualified as FL
5859import Unison.Server.Backend qualified as Backend
60+ import Unison.Server.HistoryComments.Types (DownloadCommentsResponse (.. ), UploadCommentsResponse (.. ))
61+ import Unison.Server.Types (BranchRef (.. ))
5962import Unison.Sync.Types qualified as Sync
6063import Unison.Util.Monoid (intercalateMap )
6164import Unison.Util.Monoid qualified as Monoid
@@ -267,3 +270,30 @@ instance Loggable Sync.UploadEntitiesError where
267270 Sync. UploadEntitiesError'UserNotFound userHandle ->
268271 textLog (" User not found: " <> userHandle)
269272 & withSeverity UserFault
273+
274+ instance Loggable UploadCommentsResponse where
275+ toLog = \ case
276+ UploadCommentsProjectBranchNotFound (BranchRef branchRef) ->
277+ textLog (" Project branch not found: " <> branchRef)
278+ & withSeverity UserFault
279+ UploadCommentsNotAuthorized (BranchRef branchRef) ->
280+ textLog (" Not authorized to upload comments to branch: " <> branchRef)
281+ & withSeverity UserFault
282+ UploadCommentsGenericFailure errMsg ->
283+ textLog (" Upload comments generic failure: " <> errMsg)
284+ & withSeverity Error
285+
286+ instance Loggable WS. ConnectionException where
287+ toLog = withSeverity Error . showLog
288+
289+ instance Loggable DownloadCommentsResponse where
290+ toLog = \ case
291+ DownloadCommentsProjectBranchNotFound (BranchRef branchRef) ->
292+ textLog (" Project branch not found: " <> branchRef)
293+ & withSeverity UserFault
294+ DownloadCommentsNotAuthorized (BranchRef branchRef) ->
295+ textLog (" Not authorized to download comments from branch: " <> branchRef)
296+ & withSeverity UserFault
297+ DownloadCommentsGenericFailure errMsg ->
298+ textLog (" Download comments generic failure: " <> errMsg)
299+ & withSeverity Error
0 commit comments