From d14208f5d76ef5de0a054bb2186fb3117a4bbb18 Mon Sep 17 00:00:00 2001 From: Mattias Granlund Date: Fri, 29 Nov 2024 11:21:07 +0000 Subject: [PATCH 1/2] Capture error when failing to load repo - make sure these don't go unnoticed --- apps/desktop/src/lib/components/ProblemLoadingRepo.svelte | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/desktop/src/lib/components/ProblemLoadingRepo.svelte b/apps/desktop/src/lib/components/ProblemLoadingRepo.svelte index fe38fcd236..15ffd0af96 100644 --- a/apps/desktop/src/lib/components/ProblemLoadingRepo.svelte +++ b/apps/desktop/src/lib/components/ProblemLoadingRepo.svelte @@ -10,6 +10,8 @@ import { getContext } from '@gitbutler/shared/context'; import Icon from '@gitbutler/ui/Icon.svelte'; import Spacer from '@gitbutler/ui/Spacer.svelte'; + import posthog from 'posthog-js'; + import { onMount } from 'svelte'; import { goto } from '$app/navigation'; export let error: any = undefined; @@ -35,6 +37,10 @@ projectsService.reload(); } } + + onMount(() => { + posthog.capture('repo:load_failed', { error_message: String(error) }); + }); From e9cc46248a0691886c3beea56f876a35cc0bfa97 Mon Sep 17 00:00:00 2001 From: Mattias Granlund Date: Fri, 29 Nov 2024 11:52:34 +0000 Subject: [PATCH 2/2] Show toast with error message if branches fail to load --- apps/desktop/src/lib/vbranches/virtualBranch.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/lib/vbranches/virtualBranch.ts b/apps/desktop/src/lib/vbranches/virtualBranch.ts index 7f2cf666ac..df9c5176d2 100644 --- a/apps/desktop/src/lib/vbranches/virtualBranch.ts +++ b/apps/desktop/src/lib/vbranches/virtualBranch.ts @@ -1,5 +1,6 @@ import { PatchSeries, VirtualBranch, VirtualBranches } from './types'; import { invoke, listen } from '$lib/backend/ipc'; +import { showError } from '$lib/notifications/toasts'; import { plainToInstance } from 'class-transformer'; import { writable } from 'svelte/store'; import type { BranchListingService } from '$lib/branches/branchListing'; @@ -54,9 +55,10 @@ export class VirtualBranchService { try { this.handlePayload(await this.listVirtualBranches()); this.branchListingService.refresh(); - } catch (err: any) { + } catch (err: unknown) { console.error(err); this.error.set(err); + showError('Failed to load branches', err); } finally { this.loading.set(false); }