Skip to content

Commit f316882

Browse files
committed
null -> undefined check
1 parent 9b6536c commit f316882

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

src/controllers/evaluationController.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export const evaluateApplication = async (
173173
)
174174
);
175175

176-
if (errorFetching !== undefined || application === null) {
176+
if (errorFetching !== undefined || application === undefined) {
177177
logger.warn(
178178
`No application found for alloApplicationId: ${alloApplicationId}`
179179
);
@@ -185,7 +185,7 @@ export const evaluateApplication = async (
185185
poolService.getPoolByChainIdAndAlloPoolId(chainId, alloPoolId)
186186
);
187187

188-
if (errorGetPool !== undefined || pool == null) {
188+
if (errorGetPool !== undefined || pool === undefined) {
189189
logger.warn(`No pool found for poolId: ${alloPoolId}`);
190190
res.status(404).json({ message: 'Pool not found' });
191191
return;
@@ -195,7 +195,7 @@ export const evaluateApplication = async (
195195
createEvaluation(createEvaluationParams)
196196
);
197197

198-
if (evaluationError !== undefined || evaluationResponse === null) {
198+
if (evaluationError !== undefined || evaluationResponse === undefined) {
199199
logger.error(
200200
'Evaluation creation failed:',
201201
evaluationError ?? 'Unknown error'
@@ -223,7 +223,7 @@ export const createEvaluation = async (
223223
evaluationService.createEvaluationWithAnswers(params)
224224
);
225225

226-
if (evaluationError !== undefined || evaluation == null) {
226+
if (evaluationError !== undefined || evaluation === undefined) {
227227
logger.error('Failed to create evaluation: Evaluation is null.undefined');
228228
throw new IsNullError('Evaluation is null/undefined');
229229
}
@@ -278,7 +278,11 @@ export const triggerLLMEvaluation = async (
278278
})
279279
);
280280

281-
if (errorFetching != null || indexerApplicationData == null) {
281+
if (
282+
errorFetching !== undefined ||
283+
indexerApplicationData === undefined ||
284+
indexerApplicationData === null
285+
) {
282286
logger.warn(
283287
`No pool found for chainId: ${chainId}, alloPoolId: ${alloPoolId}`
284288
);
@@ -403,7 +407,11 @@ async function processSingleEvaluation(
403407
})
404408
);
405409

406-
if (error !== undefined || fetchedRound == null) {
410+
if (
411+
error !== undefined ||
412+
fetchedRound === undefined ||
413+
fetchedRound === null
414+
) {
407415
logger.error('Failed to fetch round with applications');
408416
throw new Error('Failed to fetch round with applications');
409417
}

src/controllers/poolController.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ const throttledSync = throttle(
7171
);
7272

7373
// Handle errors or missing data from the indexer
74-
if (errorFetching != null || indexerPoolData == null) {
74+
if (
75+
errorFetching !== undefined ||
76+
indexerPoolData === undefined ||
77+
indexerPoolData === null
78+
) {
7579
logger.warn(
7680
`No pool found for chainId: ${params.chainId}, alloPoolId: ${params.alloPoolId}`
7781
);
@@ -84,7 +88,7 @@ const throttledSync = throttle(
8488
);
8589

8690
// Handle errors during the upsert operation
87-
if (error != null || pool == null) {
91+
if (error !== undefined || pool === undefined) {
8892
logger.error(`Failed to upsert pool: ${error?.message}`);
8993
throw new IsNullError(`Error upserting pool`);
9094
}
@@ -95,7 +99,10 @@ const throttledSync = throttle(
9599
);
96100

97101
// Handle errors during the evaluation question handling
98-
if (evalQuestionsError != null || evaluationQuestions == null) {
102+
if (
103+
evalQuestionsError !== undefined ||
104+
evaluationQuestions === undefined
105+
) {
99106
throw new IsNullError(`Error handling evaluation questions`);
100107
}
101108

@@ -199,7 +206,7 @@ const handlePoolEvaluationQuestions = async (
199206
requestEvaluationQuestions(poolMetadata)
200207
);
201208

202-
if (evalError == null && evaluationQuestions != null) {
209+
if (evalError === undefined && evaluationQuestions !== undefined) {
203210
break;
204211
}
205212

0 commit comments

Comments
 (0)