improve error handling for failed git fetch (#5844)

This commit is contained in:
James Gatz 2023-03-14 16:19:16 +01:00 committed by GitHub
parent 97a4d10048
commit 83f96d5f6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,7 +184,14 @@ export const gitFetchAction: ActionFunction = async ({ params }): Promise<GitFet
const gitRepository = await models.gitRepository.getById(workspaceMeta?.gitRepositoryId);
invariant(gitRepository, 'Git Repository not found');
await GitVCS.fetch({ singleBranch: true, depth: 1, credentials: gitRepository?.credentials });
try {
await GitVCS.fetch({ singleBranch: true, depth: 1, credentials: gitRepository?.credentials });
} catch (e) {
console.error(e);
return {
errors: ['Failed to fetch from remote'],
};
}
return {};
};