@@ -16,8 +16,12 @@ export const cloneRepository = async (cloneURL: string, path: string, onProgress
16
16
await git . cwd ( {
17
17
path,
18
18
} ) . 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
+ }
21
25
}
22
26
}
23
27
@@ -37,8 +41,12 @@ export const fetchRepository = async (path: string, onProgress?: (event: SimpleG
37
41
"--progress"
38
42
]
39
43
) ;
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
+ }
42
50
}
43
51
}
44
52
@@ -57,8 +65,12 @@ export const upsertGitConfig = async (path: string, gitConfig: Record<string, st
57
65
for ( const [ key , value ] of Object . entries ( gitConfig ) ) {
58
66
await git . addConfig ( key , value ) ;
59
67
}
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
+ }
62
74
}
63
75
}
64
76
0 commit comments