mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-24 18:12:48 +03:00
Merge pull request #5167 from gitbutlerapp/default-target-on-fresh-install
fix: Swallow the default target not found
This commit is contained in:
commit
05e812ca88
@ -1,7 +1,7 @@
|
||||
// Class transformers will bust a gut if this isn't imported first
|
||||
import 'reflect-metadata';
|
||||
|
||||
import { invoke } from '$lib/backend/ipc';
|
||||
import { Code, invoke } from '$lib/backend/ipc';
|
||||
import {
|
||||
getEntryName,
|
||||
getEntryUpdatedDate,
|
||||
@ -33,8 +33,15 @@ export class BranchListingService {
|
||||
}
|
||||
|
||||
private async list(filter: BranchListingFilter | undefined = undefined) {
|
||||
const entries = await invoke<any[]>('list_branches', { projectId: this.projectId, filter });
|
||||
return plainToInstance(BranchListing, entries);
|
||||
try {
|
||||
const entries = await invoke<any[]>('list_branches', { projectId: this.projectId, filter });
|
||||
return plainToInstance(BranchListing, entries);
|
||||
} catch (error: any) {
|
||||
if (error.code === Code.DefaultTargetNotFound) {
|
||||
// Swallow this error since user should be taken to project setup page
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private branchListingDetails = new Map<string, Writable<BranchListingDetails | undefined>>();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { invoke } from '$lib/backend/ipc';
|
||||
import { Code, invoke } from '$lib/backend/ipc';
|
||||
import { Branch, BranchData } from '$lib/vbranches/types';
|
||||
import { plainToInstance } from 'class-transformer';
|
||||
import { writable } from 'svelte/store';
|
||||
@ -26,6 +26,10 @@ export class RemoteBranchService {
|
||||
this.projectMetrics?.setMetric('normal_branch_count', remoteBranches.length);
|
||||
this.branches.set(remoteBranches);
|
||||
} catch (err: any) {
|
||||
if (err.code === Code.DefaultTargetNotFound) {
|
||||
// Swallow this error since user should be taken to project setup page
|
||||
return;
|
||||
}
|
||||
this.error.set(err);
|
||||
} finally {
|
||||
this.branchListingService.refresh();
|
||||
|
Loading…
Reference in New Issue
Block a user