mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 12:25:22 +00:00
catch and rethrow simplegit exceptions
This commit is contained in:
parent
d33185c118
commit
b27507eb7d
1 changed files with 28 additions and 20 deletions
|
|
@ -9,6 +9,7 @@ export const cloneRepository = async (cloneURL: string, path: string, gitConfig?
|
|||
([key, value]) => ['--config', `${key}=${value}`]
|
||||
);
|
||||
|
||||
try {
|
||||
await git.clone(
|
||||
cloneURL,
|
||||
path,
|
||||
|
|
@ -21,6 +22,9 @@ export const cloneRepository = async (cloneURL: string, path: string, gitConfig?
|
|||
await git.cwd({
|
||||
path,
|
||||
}).addConfig("remote.origin.fetch", "+refs/heads/*:refs/heads/*");
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to clone repository`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -29,6 +33,7 @@ export const fetchRepository = async (path: string, onProgress?: (event: SimpleG
|
|||
progress: onProgress,
|
||||
});
|
||||
|
||||
try {
|
||||
await git.cwd({
|
||||
path: path,
|
||||
}).fetch(
|
||||
|
|
@ -38,6 +43,9 @@ export const fetchRepository = async (path: string, onProgress?: (event: SimpleG
|
|||
"--progress"
|
||||
]
|
||||
);
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to fetch repository ${path}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const getBranches = async (path: string) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue