sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.11k stars 1.29k forks source link

fix(svelte): Workaround for handling client-side redirections in production #64520

Closed fkling closed 2 months ago

fkling commented 2 months ago

Fixes srch-927

This should fix the issue of seeing

Unexpected Error
[object Object]

when navigating to /cody/chat on dotcom and not being signed in.

This should not affect 'not found' errors that a triggered by SvelteKit itself.

This will also fix the captureException issues in Sentry, which are created when handleErrorWithSentry encounters thrown Redirects.

Test plan

Created a production Bazel build of the web app and ran it from a local instance. I added unconditional redirect and error calls to the /cody/chat page. Both have been handled as expected.