@@ -108,13 +108,27 @@ export const recreateEvaluationQuestions = async (
108
108
return ;
109
109
}
110
110
111
- await evaluationQuestionService . resetEvaluationQuestions (
112
- chainId ,
113
- alloPoolId ,
114
- evaluationQuestions
111
+ const [ errorReset ] = await catchError (
112
+ evaluationQuestionService . resetEvaluationQuestions (
113
+ chainId ,
114
+ alloPoolId ,
115
+ evaluationQuestions
116
+ )
115
117
) ;
116
118
117
- await evaluationService . cleanEvaluations ( ) ;
119
+ if ( errorReset !== undefined ) {
120
+ logger . error ( 'Failed to reset evaluation questions' , { errorReset } ) ;
121
+ res . status ( 500 ) . json ( { message : 'Failed to reset evaluation questions' } ) ;
122
+ return ;
123
+ }
124
+
125
+ const [ errorClean ] = await catchError ( evaluationService . cleanEvaluations ( ) ) ;
126
+
127
+ if ( errorClean !== undefined ) {
128
+ logger . error ( 'Failed to clean evaluations' , { errorClean } ) ;
129
+ res . status ( 500 ) . json ( { message : 'Failed to clean evaluations' } ) ;
130
+ return ;
131
+ }
118
132
119
133
res . status ( 200 ) . json ( evaluationQuestions ) ;
120
134
} ;
@@ -150,14 +164,16 @@ export const evaluateApplication = async (
150
164
summaryInput,
151
165
} ;
152
166
153
- const isAllowed = await isPoolManager < CreateEvaluationParams > (
154
- createEvaluationParams ,
155
- signature ,
156
- chainId ,
157
- alloPoolId
167
+ const [ isAllowedError , isAllowed ] = await catchError (
168
+ isPoolManager < CreateEvaluationParams > (
169
+ createEvaluationParams ,
170
+ signature ,
171
+ chainId ,
172
+ alloPoolId
173
+ )
158
174
) ;
159
175
160
- if ( ! isAllowed ) {
176
+ if ( isAllowedError !== undefined || isAllowed === undefined ) {
161
177
logger . warn (
162
178
`User with address: ${ evaluator } is not allowed to evaluate application`
163
179
) ;
@@ -301,16 +317,17 @@ export const triggerLLMEvaluation = async (
301
317
questions,
302
318
} ;
303
319
304
- try {
305
- await createLLMEvaluations ( [ data ] ) ;
306
- res . status ( 200 ) . json ( { message : 'LLM evaluation triggered successfully' } ) ;
307
- } catch ( error ) {
320
+ const [ error ] = await catchError ( createLLMEvaluations ( [ data ] ) ) ;
321
+ if ( error !== undefined ) {
308
322
logger . error ( 'Failed to create evaluations:' , error ) ;
309
323
res . status ( 500 ) . json ( {
310
324
message : 'Failed to create evaluations' ,
311
325
error : error . message ,
312
326
} ) ;
313
327
}
328
+
329
+ logger . info ( 'LLM evaluation triggered successfully' ) ;
330
+ res . status ( 200 ) . json ( { message : 'LLM evaluation triggered successfully' } ) ;
314
331
} ;
315
332
316
333
const batchPromises = < T > ( array : T [ ] , batchSize : number ) : T [ ] [ ] => {
0 commit comments