rocicorp / replicache

Realtime Sync for Any Backend Stack
https://doc.replicache.dev
1.01k stars 37 forks source link

Poor errors for invalid pusher return type #1028

Open aboodman opened 1 year ago

aboodman commented 1 year ago

See: https://discord.com/channels/830183651022471199/830183651022471202/1031283567906541642

Screen Shot 2022-10-16 at 9 26 29 AM

I used a debug build to see that error was actually:

Screen Shot 2022-10-16 at 9 26 58 AM

We need to handle these errors better and print a more comprehensible error message. Check puller too.

See also: https://github.com/rocicorp/replicache/issues/575. Perhaps should do at same time.

arv commented 1 year ago

This is once again our assertion functions not printing context aware errors.

aboodman commented 1 year ago

Is there a general pattern we can look for in the codebase to find all of these at once?

On Sun, Oct 16, 2022 at 10:27 PM Erik Arvidsson @.***> wrote:

This is once again our assertion functions not printing context aware errors.

— Reply to this email directly, view it on GitHub https://github.com/rocicorp/replicache/issues/1028#issuecomment-1280480103, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAATUBGSDK35EKBSHHCXOZLWDUEYRANCNFSM6AAAAAARGPFYNA . You are receiving this because you authored the thread.Message ID: @.***>

-- a (phone)

arv commented 1 year ago

Is there a general pattern we can look for in the codebase to find all of these at once?

Yes. These function all look like:

export function assertIndexDefinitions(
  value: unknown,
): asserts value is IndexDefinitions {
...
}