@@ -13,7 +13,6 @@ module Unison.SyncV3.Types
1313 )
1414where
1515
16- import Unison.SyncCommon.Types
1716import Codec.Serialise (Serialise )
1817import Codec.Serialise qualified as CBOR
1918import Control.Lens hiding ((.=) )
@@ -34,6 +33,7 @@ import Unison.Hash32 (Hash32)
3433import Unison.Prelude (tShow )
3534import Unison.Server.Orphans ()
3635import Unison.Sqlite qualified as Sqlite
36+ import Unison.SyncCommon.Types
3737import Unison.Util.Servant.CBOR qualified as CBOR
3838
3939data InitMsg authedHash = InitMsg
@@ -159,6 +159,11 @@ data SyncError
159159 | -- The caller asked for a Hash they shouldn't have access to.
160160 ForbiddenEntityRequest (Set (EntityKind , Hash32 ))
161161 | ConnectionError Text
162+ | ProjectNotFound BranchRef
163+ | UserNotFound BranchRef
164+ | NoReadPermission BranchRef
165+ | HashJWTVerificationError Text
166+ | InvalidBranchRef Text BranchRef
162167 deriving (Show , Eq )
163168
164169-- | Roundtrip test:
@@ -183,6 +188,16 @@ instance CBOR.Serialise SyncError where
183188 CBOR. encode (3 :: Int ) <> CBOR. encode hashes
184189 ConnectionError err ->
185190 CBOR. encode (4 :: Int ) <> CBOR. encode err
191+ ProjectNotFound branchRef ->
192+ CBOR. encode (5 :: Int ) <> CBOR. encode branchRef
193+ UserNotFound branchRef ->
194+ CBOR. encode (6 :: Int ) <> CBOR. encode branchRef
195+ NoReadPermission branchRef ->
196+ CBOR. encode (7 :: Int ) <> CBOR. encode branchRef
197+ HashJWTVerificationError err ->
198+ CBOR. encode (8 :: Int ) <> CBOR. encode err
199+ InvalidBranchRef err branchRef ->
200+ CBOR. encode (9 :: Int ) <> CBOR. encode err <> CBOR. encode branchRef
186201
187202 decode = do
188203 tag <- CBOR. decode @ Int
@@ -196,6 +211,14 @@ instance CBOR.Serialise SyncError where
196211 4 -> do
197212 err <- CBOR. decode @ Text
198213 pure $ ConnectionError err
214+ 5 -> ProjectNotFound <$> CBOR. decode
215+ 6 -> UserNotFound <$> CBOR. decode
216+ 7 -> NoReadPermission <$> CBOR. decode
217+ 8 -> HashJWTVerificationError <$> CBOR. decode
218+ 9 -> do
219+ err <- CBOR. decode @ Text
220+ branchRef <- CBOR. decode @ BranchRef
221+ pure $ InvalidBranchRef err branchRef
199222 _ -> fail $ " Unknown SyncError tag: " <> show tag
200223
201224-- A message sent from the emitter to the downloader.
0 commit comments