Open phritz opened 4 years ago
// The error paths of beginSync and maybeEndSync need to be reworked.
//
// We want to distinguish between:
// a) network requests failed -- we're offline basically
// b) sync was aborted because one's already in progress
// c) oh noes - something unexpected happened
//
// Right now, all of these come out as errors. We distinguish (b) with a
// hacky string search. (a) and (c) are not distinguishable currently
// because repc doesn't provide sufficient information, so we treat all
// errors that aren't (b) as (a).
Another signal we want in bindings is if the diffserver got a 401 from the data layer (so bindings can trigger app-level data layer re-auth).
Ick. A failed push is not fatal for beginsync and so the push status code is correctly returned in beginsyncresponse.syncinfo.batchpushinfo.httpstatuscode. However a failed pull is fatal for the sync and so it throws an error, eg PullFailed(FetchNotOk(400))
. we also have to check for PullFailed(FetchNotOk(4\d\d))
in the js :(
we are suffering from lack of structured errors returned by repc:
Note this could be solved by bringing more regularity to our rpcs a la https://github.com/rocicorp/repc/issues/119#issuecomment-691306940