Skip to content

Commit

Permalink
Handle rare but possible situation where by_field_value can be stored…
Browse files Browse the repository at this point in the history
… as a -1
  • Loading branch information
Kerry350 committed Jan 26, 2021
1 parent 86e2121 commit d3ad661
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,14 @@ export async function getLogEntryAnomalies(

const parsedAnomaliesWithExpandedCategoryInformation = parsedAnomalies.map((anomaly) => {
if (isCategoryAnomaly(anomaly)) {
const {
_source: { regex, terms },
} = logEntryCategoriesById[parseInt(anomaly.categoryId, 10)];
return { ...anomaly, ...{ categoryRegex: regex, categoryTerms: terms } };
if (logEntryCategoriesById[parseInt(anomaly.categoryId, 10)]) {
const {
_source: { regex, terms },
} = logEntryCategoriesById[parseInt(anomaly.categoryId, 10)];
return { ...anomaly, ...{ categoryRegex: regex, categoryTerms: terms } };
} else {
return { ...anomaly, ...{ categoryRegex: '', categoryTerms: '' } };
}
} else {
return anomaly;
}
Expand Down

0 comments on commit d3ad661

Please sign in to comment.