Skip to content

Commit

Permalink
Merge pull request #5712 from gitbutlerapp/more-error-telemetry
Browse files Browse the repository at this point in the history
Capture error when failing to load repo
  • Loading branch information
krlvi authored Nov 30, 2024
2 parents 5aab7ec + e9cc462 commit 9b48929
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions apps/desktop/src/lib/components/ProblemLoadingRepo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -35,6 +37,10 @@
projectsService.reload();
}
}
onMount(() => {
posthog.capture('repo:load_failed', { error_message: String(error) });
});
</script>

<DecorativeSplitView img={loadErrorSvg}>
Expand Down
4 changes: 3 additions & 1 deletion apps/desktop/src/lib/vbranches/virtualBranch.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 9b48929

Please sign in to comment.