mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #331 from omnivore-app/fix/update-page-after-deletion
fix document_missing_exception being thrown to sentry when updating page in elastic
This commit is contained in:
commit
d9af397b9c
1 changed files with 8 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ import {
|
|||
} from './types'
|
||||
import { readFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { ResponseError } from '@elastic/elasticsearch/lib/errors'
|
||||
|
||||
const INDEX_NAME = 'pages'
|
||||
const INDEX_ALIAS = 'pages_alias'
|
||||
|
|
@ -210,6 +211,13 @@ export const updatePage = async (
|
|||
|
||||
return true
|
||||
} catch (e) {
|
||||
if (
|
||||
e instanceof ResponseError &&
|
||||
e.message === 'document_missing_exception'
|
||||
) {
|
||||
console.info('page has been deleted', id)
|
||||
return false
|
||||
}
|
||||
console.error('failed to update a page in elastic', e)
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue