@@ -49,19 +49,34 @@ async function analyzeBenchmarksForVersion(
49
49
/**
50
50
* Runs the benchmark analysis for a specified version or current version
51
51
* @param specifiedVersion Optional version to analyze. If not provided, uses current package version
52
+ * @param debugMode If true, throws errors instead of writing them to markdown
52
53
*/
53
- async function runBenchmarkAnalysis ( specifiedVersion ?: string ) : Promise < void > {
54
+ async function runBenchmarkAnalysis (
55
+ specifiedVersion ?: string ,
56
+ debugMode : boolean = false
57
+ ) : Promise < void > {
54
58
const versionToAnalyze = specifiedVersion ?? currentAzleVersion ;
55
59
console . info ( 'Analyzing benchmarks...' ) ;
56
60
try {
57
61
const statistics = await analyzeBenchmarksForVersion ( versionToAnalyze ) ;
58
62
await reportResults ( statistics , versionToAnalyze ) ;
59
63
} catch ( error ) {
60
- const errorMessage =
61
- error instanceof Error ? error . message : String ( error ) ;
62
- await reportErrorResult ( errorMessage , versionToAnalyze ) ;
64
+ if ( debugMode ) {
65
+ // In debug mode, throw the error to get stack traces and immediate feedback
66
+ throw error ;
67
+ } else {
68
+ // In normal mode, write error to markdown for PR visibility
69
+ const errorMessage =
70
+ error instanceof Error ? error . message : String ( error ) ;
71
+ await reportErrorResult ( errorMessage , versionToAnalyze ) ;
72
+ }
63
73
}
64
74
console . info ( `Report generated at ${ MARKDOWN_FILE } ` ) ;
65
75
}
66
76
67
- runBenchmarkAnalysis ( process . argv [ 2 ] ) ;
77
+ // Parse command line arguments
78
+ const args = process . argv . slice ( 2 ) ;
79
+ const debugMode = args . includes ( '--debug' ) === true ;
80
+ const versionArg = args . find ( ( arg ) => arg . startsWith ( '--' ) === false ) ;
81
+
82
+ runBenchmarkAnalysis ( versionArg , debugMode ) ;
0 commit comments