@@ -27,6 +27,7 @@ import { tryOpenExternalFile } from "../common/vscode/external-files";
27
27
import type { VariantAnalysisManager } from "./variant-analysis-manager" ;
28
28
import type { VariantAnalysisResultsManager } from "./variant-analysis-results-manager" ;
29
29
import { getAutofixPath , getAutofixModel } from "../config" ;
30
+ import { getErrorMessage } from "../common/helpers-pure" ;
30
31
31
32
// Limit to three repos when generating autofixes so not sending
32
33
// too many requests to autofix. Since we only need to validate
@@ -497,8 +498,9 @@ async function downloadPublicCommitSource(
497
498
498
499
return checkoutDir ;
499
500
} catch ( error ) {
500
- const errorMessage = error instanceof Error ? error . message : String ( error ) ;
501
- throw new Error ( `Failed to download ${ nwo } at ${ sha } : ${ errorMessage } ` ) ;
501
+ throw new Error (
502
+ `Failed to download ${ nwo } at ${ sha } :. Reason: ${ getErrorMessage ( error ) } ` ,
503
+ ) ;
502
504
}
503
505
}
504
506
@@ -755,8 +757,7 @@ async function mergeFiles(
755
757
await Promise . all ( inputFiles . map ( ( file ) => unlink ( file ) ) ) ;
756
758
}
757
759
} catch ( error ) {
758
- console . error ( "Error merging files:" , error ) ;
759
- throw error ;
760
+ throw new Error ( `Error merging files. Reason: ${ getErrorMessage ( error ) } ` ) ;
760
761
}
761
762
}
762
763
@@ -791,7 +792,6 @@ async function formatWithMarkdown(
791
792
// Write the formatted content back to the file
792
793
await writeFile ( inputFile , formattedContent ) ;
793
794
} catch ( error ) {
794
- console . error ( "Error formatting file:" , error ) ;
795
- throw error ;
795
+ throw new Error ( `Error formatting file. Reason: ${ getErrorMessage ( error ) } ` ) ;
796
796
}
797
797
}
0 commit comments