-
Notifications
You must be signed in to change notification settings - Fork 18
Handle index not found error #273
Handle index not found error #273
Conversation
server/routes/ad.ts
Outdated
err.statusCode === 404 && | ||
get<string>(err, 'body.error.type', '') === 'index_not_found_exception' | ||
) { | ||
if (isIndexNotFoundError(err)) { | ||
return { ok: true, response: { totalDetectors: 0, detectors: [] } }; | ||
} | ||
console.log('Anomaly detector - Unable to search detectors', err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would prefer logging before any return
, right after catch
. same below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would prefer logging before any
return
, right aftercatch
. same below.
In this case, do you mean adding an additional log in the if
block here? Could add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. just moving console.log()
before if(isIndexNotFoundError)
should be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I see, will change
Issue #, if available:
Description of changes:
#267 propagated a generic message to the user when there was errors retrieving detectors on the dashboard and detector list pages. One of these errors included an
index_not_found_exception
, which is most likely not an error, but is because the housekeeping AD indices are not all created until a user creates and starts a detector.This fixes that by suppressing that error, similar to how the existing
searchDetector()
was doing it, and consequently doesn't show any errors on the dashboard and detector list pages when those indices don't exist yet.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.