@@ -41,18 +41,18 @@ public async Task<bool> RunAsync()
4141 try
4242 {
4343 await File . WriteAllTextAsync ( _tmpFile , _message ) . ConfigureAwait ( false ) ;
44-
44+
4545 // Store original RaiseError setting to provide custom error handling
4646 var originalRaiseError = RaiseError ;
4747 RaiseError = false ;
48-
48+
4949 var result = await ReadToEndAsync ( ) . ConfigureAwait ( false ) ;
50-
50+
5151 if ( ! result . IsSuccess )
5252 {
5353 // Check for common GPG signing errors and provide helpful messages
5454 var errorMessage = result . StdErr ;
55-
55+
5656 if ( errorMessage . Contains ( "gpg failed to sign" , System . StringComparison . OrdinalIgnoreCase ) ||
5757 errorMessage . Contains ( "gpg: signing failed" , System . StringComparison . OrdinalIgnoreCase ) )
5858 {
@@ -63,7 +63,7 @@ public async Task<bool> RunAsync()
6363 "• Passphrase required but no TTY available\n " +
6464 "• Key expired or revoked\n \n " +
6565 "Original error: " + errorMessage ;
66-
66+
6767 if ( originalRaiseError )
6868 App . RaiseException ( Context , enhancedMessage ) ;
6969 }
@@ -74,7 +74,7 @@ public async Task<bool> RunAsync()
7474 "• Verify the signing key in git config matches your GPG key\n " +
7575 "• Run 'gpg --list-secret-keys' to see available keys\n \n " +
7676 "Original error: " + errorMessage ;
77-
77+
7878 if ( originalRaiseError )
7979 App . RaiseException ( Context , enhancedMessage ) ;
8080 }
@@ -86,7 +86,7 @@ public async Task<bool> RunAsync()
8686 "• Try running: export GPG_TTY=$(tty)\n " +
8787 "• Or disable commit signing temporarily: git config commit.gpgsign false\n \n " +
8888 "Original error: " + errorMessage ;
89-
89+
9090 if ( originalRaiseError )
9191 App . RaiseException ( Context , enhancedMessage ) ;
9292 }
@@ -97,15 +97,15 @@ public async Task<bool> RunAsync()
9797 App . RaiseException ( Context , errorMessage ) ;
9898 }
9999 }
100-
100+
101101 File . Delete ( _tmpFile ) ;
102102 return result . IsSuccess ;
103103 }
104104 catch ( System . Exception ex )
105105 {
106106 if ( File . Exists ( _tmpFile ) )
107107 File . Delete ( _tmpFile ) ;
108-
108+
109109 App . RaiseException ( Context , $ "Commit operation failed: { ex . Message } ") ;
110110 return false ;
111111 }
0 commit comments