@@ -16,8 +16,12 @@ export const cloneRepository = async (cloneURL: string, path: string, onProgress
1616 await git . cwd ( {
1717 path,
1818 } ) . addConfig ( "remote.origin.fetch" , "+refs/heads/*:refs/heads/*" ) ;
19- } catch ( error ) {
20- throw new Error ( `Failed to clone repository` ) ;
19+ } catch ( error : unknown ) {
20+ if ( error instanceof Error ) {
21+ throw new Error ( `Failed to clone repository: ${ error . message } ` ) ;
22+ } else {
23+ throw new Error ( `Failed to clone repository: ${ error } ` ) ;
24+ }
2125 }
2226}
2327
@@ -37,8 +41,12 @@ export const fetchRepository = async (path: string, onProgress?: (event: SimpleG
3741 "--progress"
3842 ]
3943 ) ;
40- } catch ( error ) {
41- throw new Error ( `Failed to fetch repository ${ path } ` ) ;
44+ } catch ( error : unknown ) {
45+ if ( error instanceof Error ) {
46+ throw new Error ( `Failed to fetch repository ${ path } : ${ error . message } ` ) ;
47+ } else {
48+ throw new Error ( `Failed to fetch repository ${ path } : ${ error } ` ) ;
49+ }
4250 }
4351}
4452
@@ -57,8 +65,12 @@ export const upsertGitConfig = async (path: string, gitConfig: Record<string, st
5765 for ( const [ key , value ] of Object . entries ( gitConfig ) ) {
5866 await git . addConfig ( key , value ) ;
5967 }
60- } catch ( error ) {
61- throw new Error ( `Failed to set git config ${ path } ` ) ;
68+ } catch ( error : unknown ) {
69+ if ( error instanceof Error ) {
70+ throw new Error ( `Failed to set git config ${ path } : ${ error . message } ` ) ;
71+ } else {
72+ throw new Error ( `Failed to set git config ${ path } : ${ error } ` ) ;
73+ }
6274 }
6375}
6476
0 commit comments