@@ -84,19 +84,19 @@ export async function rateGeneratedCode(
84
84
for ( const current of currentPromptDef . ratings ) {
85
85
let result : IndividualAssessment | SkippedIndividualAssessment ;
86
86
87
- if ( current . kind === RatingKind . PER_BUILD ) {
88
- result = runPerBuildRating (
89
- current ,
90
- buildResult ,
91
- repairAttempts ,
92
- outputFiles . length ,
93
- axeRepairAttempts
94
- ) ;
95
- } else if ( current . kind === RatingKind . PER_FILE ) {
96
- categorizedFiles ??= splitFilesIntoCategories ( outputFiles ) ;
97
- result = await runPerFileRating ( current , categorizedFiles ) ;
98
- } else if ( current . kind === RatingKind . LLM_BASED ) {
99
- try {
87
+ try {
88
+ if ( current . kind === RatingKind . PER_BUILD ) {
89
+ result = runPerBuildRating (
90
+ current ,
91
+ buildResult ,
92
+ repairAttempts ,
93
+ outputFiles . length ,
94
+ axeRepairAttempts
95
+ ) ;
96
+ } else if ( current . kind === RatingKind . PER_FILE ) {
97
+ categorizedFiles ??= splitFilesIntoCategories ( outputFiles ) ;
98
+ result = await runPerFileRating ( current , categorizedFiles ) ;
99
+ } else if ( current . kind === RatingKind . LLM_BASED ) {
100
100
result = await runLlmBasedRating (
101
101
environment ,
102
102
current ,
@@ -109,14 +109,14 @@ export async function rateGeneratedCode(
109
109
axeRepairAttempts ,
110
110
abortSignal
111
111
) ;
112
- } catch ( error ) {
113
- result = getSkippedAssessment (
114
- current ,
115
- `Error during execution:\n${ error } `
116
- ) ;
112
+ } else {
113
+ throw new UserFacingError ( `Unsupported rating type ${ current } ` ) ;
117
114
}
118
- } else {
119
- throw new UserFacingError ( `Unsupported rating type ${ current } ` ) ;
115
+ } catch ( error ) {
116
+ result = getSkippedAssessment (
117
+ current ,
118
+ `Error during execution:\n${ error } `
119
+ ) ;
120
120
}
121
121
122
122
if ( result . state === IndividualAssessmentState . EXECUTED && result . usage ) {
0 commit comments